add 'note_author' method on Note
This commit is contained in:
@@ -37,6 +37,8 @@ class Note(models.Model):
|
||||
child_instance = self.cast()
|
||||
self.created_date = child_instance.note_date()
|
||||
self.created_time = child_instance.note_time()
|
||||
if not self.created_by:
|
||||
self.created_by = self.cast().note_author()
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
@@ -44,6 +46,9 @@ class Note(models.Model):
|
||||
self.created_date,
|
||||
self.created_time)
|
||||
|
||||
def note_author(self):
|
||||
return None
|
||||
|
||||
def note_date(self):
|
||||
""" Default 'created_date' value. Child may override this method. """
|
||||
return timezone.now().date()
|
||||
|
||||
Reference in New Issue
Block a user