X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/bb41f36c58707df91ca96b39b41f51e98306aee7..36a2bfc8fc84eefbb9f2e69a38f3a51a74850e34:/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: