diff 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
line wrap: on
line diff
--- a/mysite/band/models.py	Tue Jun 02 00:47:37 2009 +0000
+++ b/mysite/band/models.py	Sun Dec 13 21:47:08 2009 +0000
@@ -221,7 +221,7 @@
 #######################################################################
 
 class Video_Set(models.Model):
-   date = models.DateField(auto_now_add = True, editable = False)
+   date = models.DateField(blank=True)
    title = models.CharField(max_length = 64)
    text = models.TextField()
 
@@ -232,6 +232,12 @@
       ordering = ('date', )
       verbose_name = "Video Set"
 
+   def save(self, *args, **kwargs):
+      if not self.id:
+          self.date = datetime.date.today()
+
+      super(Video_Set, self).save(*args, **kwargs)
+
 #######################################################################
 
 class Video(models.Model):