X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/bb41f36c58707df91ca96b39b41f51e98306aee7..1d52e86052f68c0437cbd6b9a51155edba808a81:/notes/models.py?ds=sidebyside diff --git a/notes/models.py b/notes/models.py index 5541224..f5ab091 100644 --- a/notes/models.py +++ b/notes/models.py @@ -64,6 +64,12 @@ class Note(models.Model): 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: