diff options
Diffstat (limited to 'app/publications/models.py')
-rw-r--r-- | app/publications/models.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/publications/models.py b/app/publications/models.py index 9163602..d47d5f6 100644 --- a/app/publications/models.py +++ b/app/publications/models.py @@ -105,3 +105,23 @@ class Pitch(models.Model): self.date_created = timezone.now() self.date_updated = timezone.now() super(Pitch, self).save() + + +class PitchIdea(models.Model): + title = models.CharField(max_length=250) + pitch = models.TextField() + publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + + class Meta: + ordering = ('-title', '-date_created') + + def __str__(self): + return self.title + + def save(self, *args, **kwargs): + if self._state.adding: + self.date_created = timezone.now() + self.date_updated = timezone.now() + super(PitchIdea, self).save() |