bgneal@50: """ bgneal@50: Models for the videos application. bgneal@50: bgneal@50: """ bgneal@50: from django.db import models bgneal@50: bgneal@50: bgneal@50: class Collection(models.Model): bgneal@50: """ bgneal@50: This model represents a collection of videos. bgneal@50: bgneal@50: """ bgneal@50: title = models.CharField(max_length=64) bgneal@50: description = models.TextField() bgneal@50: date_added = models.DateTimeField() bgneal@50: bgneal@50: class Meta: bgneal@50: ordering = ['-date_added'] bgneal@50: bgneal@50: def __unicode__(self): bgneal@50: return self.title bgneal@50: bgneal@50: @models.permalink bgneal@50: def get_absolute_url(self): bgneal@50: return ('videos-item', [], {'pk': str(self.id)}) bgneal@50: bgneal@50: bgneal@50: class Video(models.Model): bgneal@50: """ bgneal@50: This model represents a video clip hosted on a remote video sharing site bgneal@50: (e.g. YouTube). bgneal@50: bgneal@50: """ bgneal@50: title = models.CharField(max_length=64) bgneal@50: embed_code = models.TextField() bgneal@50: collection = models.ForeignKey(Collection) bgneal@50: bgneal@50: class Meta: bgneal@50: ordering = ['title'] bgneal@50: bgneal@50: def __unicode__(self): bgneal@50: return self.title