X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/bb41f36c58707df91ca96b39b41f51e98306aee7..218a404a6467fc7acab06efd5f1049acbc174cf2:/notes/models.py 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: