diff gpp/weblinks/models.py @ 20:c0d0779b266f

Created a template tag for the latest weblinks: latest_weblinks. This necessitated adding a get_absolute_url function for the Link model along with a new view for it.
author Brian Neal <bgneal@gmail.com>
date Sun, 19 Apr 2009 20:41:37 +0000
parents dbd703f7d63a
children 952e05cb3d80
line wrap: on
line diff
--- a/gpp/weblinks/models.py	Sun Apr 19 20:10:00 2009 +0000
+++ b/gpp/weblinks/models.py	Sun Apr 19 20:41:37 2009 +0000
@@ -43,11 +43,15 @@
     objects = models.Manager()
     public_objects = PublicLinkManager()
 
+    class Meta:
+        ordering = ('title', )
+
     def __unicode__(self):
         return self.title
 
-    class Meta:
-        ordering = ('title', )
+    @models.permalink
+    def get_absolute_url(self):
+        return ('weblinks-link_detail', [str(self.id)])
 
 
 class FlaggedLinkManager(models.Manager):