Commits

Steve Losh  committed 988a556

Cleaned up the get_absolute_url methods so they no longer suck.

  • Participants
  • Parent commits 185ed63

Comments (0)

Files changed (4)

File blog/models.py

         return u'%s' % (self.title,)
 
 class Comment(models.Model):
-    name = models.CharField('Commenter', blank=False, null=False,
-                            max_length=40)
+    name = models.CharField('Commenter', blank=False, null=False, max_length=40)
     body = models.TextField('Comment', blank=False, null=False)
     submitted = models.DateTimeField(default=datetime.datetime.now)
     entry = models.ForeignKey(Entry)

File djschedule/models.py

     carrier = models.ForeignKey(Carrier, blank=True, null=True)
     approved = models.BooleanField(default=False)
     
+    @models.permalink
+    def get_absolute_url(self):
+        return ('djschedule-index',)
+    
     def __unicode__(self):
         return u'%s - %s' % (str(self.dj_date), self.name)
 

File links/models.py

     submitted = models.DateTimeField(default=datetime.datetime.now)
     approved = models.BooleanField(default=False)
     
+    @models.permalink
     def get_absolute_url(self):
-        return self.url
+        return ('links-list',)
     
     def __unicode__(self):
         return u'%s' % (str(self.title),)

File playlists/models.py

     name = models.CharField(blank=False, null=False, max_length=50)
     where = models.CharField(blank=False, null=False, max_length=80)
     
+    @models.permalink
+    def get_absolute_url(self):
+        return ('playlists-single', (self.date.year, self.date.month, 
+                                     self.date.day, self.name),)
+    
     def __unicode__(self):
         return u"%s on %s" % (self.name, self.date)