diff gpp/potd/models.py @ 14:7b6540b185d9

Added get_absolute_url() for my comments. Had to add a get_absolute_url() function for downloads in the process.
author Brian Neal <bgneal@gmail.com>
date Sat, 18 Apr 2009 19:14:17 +0000
parents dbd703f7d63a
children 5c889b587416
line wrap: on
line diff
--- a/gpp/potd/models.py	Thu Apr 16 02:00:17 2009 +0000
+++ b/gpp/potd/models.py	Sat Apr 18 19:14:17 2009 +0000
@@ -34,11 +34,15 @@
     date_added = models.DateField(auto_now_add=True)
     potd_count = models.IntegerField(default=0)
 
+    class Meta:
+        ordering = ('-date_added', '-caption')
+
     def __unicode__(self):
         return u'%s (%s)' % (self.caption, self.pk)
 
-    class Meta:
-        ordering = ('-date_added', '-caption')
+    @models.permalink
+    def get_absolute_url(self):
+        return ('potd-archive', [str(self.id)])
 
     def save(self, force_insert=False, force_update=False):