Mercurial > public > madeira
comparison videos/models.py @ 71:e2868ad47a1e
For Django 1.4, using the new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 14 Apr 2012 16:40:29 -0500 |
parents | madeira/videos/models.py@5913ddcebea4 |
children |
comparison
equal
deleted
inserted
replaced
70:f26cdda0ad8b | 71:e2868ad47a1e |
---|---|
1 """ | |
2 Models for the videos application. | |
3 | |
4 """ | |
5 from django.db import models | |
6 | |
7 | |
8 class Collection(models.Model): | |
9 """ | |
10 This model represents a collection of videos. | |
11 | |
12 """ | |
13 title = models.CharField(max_length=64) | |
14 description = models.TextField() | |
15 date_added = models.DateTimeField() | |
16 | |
17 class Meta: | |
18 ordering = ['-date_added'] | |
19 | |
20 def __unicode__(self): | |
21 return self.title | |
22 | |
23 @models.permalink | |
24 def get_absolute_url(self): | |
25 return ('videos-item', [], {'pk': str(self.id)}) | |
26 | |
27 | |
28 class Video(models.Model): | |
29 """ | |
30 This model represents a video clip hosted on a remote video sharing site | |
31 (e.g. YouTube). | |
32 | |
33 """ | |
34 title = models.CharField(max_length=64) | |
35 embed_code = models.TextField() | |
36 collection = models.ForeignKey(Collection) | |
37 | |
38 class Meta: | |
39 ordering = ['title'] | |
40 | |
41 def __unicode__(self): | |
42 return self.title |