diff gpp/potd/models.py @ 535:4021ea1045f7

Adding import commands for the 1.0 POTD & comments.
author Brian Neal <bgneal@gmail.com>
date Sat, 31 Dec 2011 21:34:17 +0000
parents ff67946fd4b0
children
line wrap: on
line diff
--- a/gpp/potd/models.py	Tue Dec 27 01:15:27 2011 +0000
+++ b/gpp/potd/models.py	Sat Dec 31 21:34:17 2011 +0000
@@ -2,6 +2,7 @@
 Models for the Photo Of The Day (POTD) application.
 
 """
+import datetime
 import os
 from PIL import ImageFile
 from PIL import Image
@@ -32,7 +33,7 @@
     caption = models.CharField(max_length=128)
     description = models.TextField()
     user = models.ForeignKey(User)
-    date_added = models.DateField(auto_now_add=True)
+    date_added = models.DateField()
     potd_count = models.IntegerField(default=0)
 
     class Meta:
@@ -48,6 +49,7 @@
     def save(self, *args, **kwargs):
         if not self.pk:
             self.generate_thumb()
+            self.date_added = datetime.datetime.now()
 
         super(Photo, self).save(*args, **kwargs)
 
@@ -169,7 +171,7 @@
     objects = SequenceManager()
 
     def __unicode__(self):
-        return self.seq
+        return u'POTD Sequence %d' % self.id
 
     class Meta:
         verbose_name_plural = 'Sequence'