Mercurial > public > madeira
annotate videos/models.py @ 133:d618107d2120
Updated requirements.txt for Django 1.6.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 24 Dec 2013 17:27:20 -0600 |
parents | e2868ad47a1e |
children |
rev | line source |
---|---|
bgneal@50 | 1 """ |
bgneal@50 | 2 Models for the videos application. |
bgneal@50 | 3 |
bgneal@50 | 4 """ |
bgneal@50 | 5 from django.db import models |
bgneal@50 | 6 |
bgneal@50 | 7 |
bgneal@50 | 8 class Collection(models.Model): |
bgneal@50 | 9 """ |
bgneal@50 | 10 This model represents a collection of videos. |
bgneal@50 | 11 |
bgneal@50 | 12 """ |
bgneal@50 | 13 title = models.CharField(max_length=64) |
bgneal@50 | 14 description = models.TextField() |
bgneal@50 | 15 date_added = models.DateTimeField() |
bgneal@50 | 16 |
bgneal@50 | 17 class Meta: |
bgneal@50 | 18 ordering = ['-date_added'] |
bgneal@50 | 19 |
bgneal@50 | 20 def __unicode__(self): |
bgneal@50 | 21 return self.title |
bgneal@50 | 22 |
bgneal@50 | 23 @models.permalink |
bgneal@50 | 24 def get_absolute_url(self): |
bgneal@50 | 25 return ('videos-item', [], {'pk': str(self.id)}) |
bgneal@50 | 26 |
bgneal@50 | 27 |
bgneal@50 | 28 class Video(models.Model): |
bgneal@50 | 29 """ |
bgneal@50 | 30 This model represents a video clip hosted on a remote video sharing site |
bgneal@50 | 31 (e.g. YouTube). |
bgneal@50 | 32 |
bgneal@50 | 33 """ |
bgneal@50 | 34 title = models.CharField(max_length=64) |
bgneal@50 | 35 embed_code = models.TextField() |
bgneal@50 | 36 collection = models.ForeignKey(Collection) |
bgneal@50 | 37 |
bgneal@50 | 38 class Meta: |
bgneal@50 | 39 ordering = ['title'] |
bgneal@50 | 40 |
bgneal@50 | 41 def __unicode__(self): |
bgneal@50 | 42 return self.title |