+ return self.status == 1
+
+@receiver(pre_save, sender=Note)
+def note_pre_save(sender, instance, **kwargs):
+ if instance.pk is None:
+ if instance.status == 1:
+ instance.published_at = datetime.now()
+ else:
+ old_instance = Note.objects.get(pk=instance.pk)
+
+ if old_instance.status == 0 and instance.status == 1:
+ instance.published_at = datetime.now()
\ No newline at end of file