]> git.p6c8.net - pcdenotes.git/blobdiff - notes/models.py
Show publication date when rendering a note
[pcdenotes.git] / notes / models.py
index 5541224bbc1f5a39fbd38aca07dd9e2eb434cf81..f5ab091af915b954d113b7e0fdebd3f58b9642d0 100644 (file)
@@ -64,6 +64,12 @@ class Note(models.Model):
     def is_published(self):
         return self.status == 1
 
     def is_published(self):
         return self.status == 1
 
+    def publication_date(self):
+        if self.published_at is None:
+            return self.created_at
+        else:
+            return self.published_at
+
 @receiver(pre_save, sender=Note)
 def note_pre_save(sender, instance, **kwargs):
     if instance.pk is None:
 @receiver(pre_save, sender=Note)
 def note_pre_save(sender, instance, **kwargs):
     if instance.pk is None:

patrick-canterino.de