No images in this repository’s iceberg at this time
Download raw (1.4 KB)
from django.db import models class Tag(models.Model): """Represents a tag""" name = models.CharField(max_length=100, unique=True) def __unicode__(self): return self.name class Photo(models.Model): """Represents a photograph""" url = models.URLField() caption = models.TextField(blank=True, null=True) height = models.PositiveIntegerField(blank=True, null=True) width = models.PositiveIntegerField(blank=True, null=True) def __unicode__(self): return self.url class Tumblr(models.Model): """Represent a Tumblr item""" url = models.URLField(unique=True) blog_name = models.CharField(max_length=100) date = models.DateTimeField() body = models.TextField() caption = models.TextField() text = models.TextField() source = models.CharField(max_length=100) tags = models.ManyToManyField(Tag) photos = models.ManyToManyField(Photo) class Meta: ordering = ("-date",) def __unicode__(self): return self.body[0:100] class Twitter(models.Model): """Represents a Twitter item""" url = models.URLField(unique=True) user = models.CharField(max_length=100) screen_name = models.CharField(max_length=100) date = models.DateTimeField() text = models.TextField() photos = models.ManyToManyField(Photo) class Meta: ordering = ("-date",) def __unicode__(self): return self.text