Commits

Guilherme Gondim committed f358687

add get_absolute_url method

Comments (0)

Files changed (1)

diario/models/__init__.py

 #  Software Foundation. See the file README for copying conditions.
 #
 
+from django.db.models import permalink
 from django.utils.translation import ugettext_lazy as _
 
 from diario.models.managers import EntryManager, CurrentSiteEntryManager
 
     def __unicode__(self):
         return self.title
+
+    @permalink
+    def get_absolute_url(self):
+        return ('diario-entry-detail', None, {
+            'year' : str(self.pub_date.year),
+            'month': str(self.pub_date.month).zfill(2),
+            'day'  : str(self.pub_date.day).zfill(2),
+            'slug' : str(self.slug)
+        })