Mercurial > public > madeira
comparison mysite/band/models.py @ 9:dac690ab98b2
Display video sets on index page by date in descending order. Allow the video set date to be edited.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 13 Dec 2009 21:47:08 +0000 |
parents | e602b5302b94 |
children | 25e00d1b99bf |
comparison
equal
deleted
inserted
replaced
8:3e22a6fde2d2 | 9:dac690ab98b2 |
---|---|
219 verbose_name = "MP3" | 219 verbose_name = "MP3" |
220 | 220 |
221 ####################################################################### | 221 ####################################################################### |
222 | 222 |
223 class Video_Set(models.Model): | 223 class Video_Set(models.Model): |
224 date = models.DateField(auto_now_add = True, editable = False) | 224 date = models.DateField(blank=True) |
225 title = models.CharField(max_length = 64) | 225 title = models.CharField(max_length = 64) |
226 text = models.TextField() | 226 text = models.TextField() |
227 | 227 |
228 def __unicode__(self): | 228 def __unicode__(self): |
229 return self.title | 229 return self.title |
230 | 230 |
231 class Meta: | 231 class Meta: |
232 ordering = ('date', ) | 232 ordering = ('date', ) |
233 verbose_name = "Video Set" | 233 verbose_name = "Video Set" |
234 | |
235 def save(self, *args, **kwargs): | |
236 if not self.id: | |
237 self.date = datetime.date.today() | |
238 | |
239 super(Video_Set, self).save(*args, **kwargs) | |
234 | 240 |
235 ####################################################################### | 241 ####################################################################### |
236 | 242 |
237 class Video(models.Model): | 243 class Video(models.Model): |
238 video_set = models.ForeignKey(Video_Set) | 244 video_set = models.ForeignKey(Video_Set) |