summaryrefslogtreecommitdiff
path: root/app/publications
diff options
context:
space:
mode:
Diffstat (limited to 'app/publications')
-rw-r--r--app/publications/admin.py14
-rw-r--r--app/publications/models.py20
2 files changed, 33 insertions, 1 deletions
diff --git a/app/publications/admin.py b/app/publications/admin.py
index a09e7d5..96a93ec 100644
--- a/app/publications/admin.py
+++ b/app/publications/admin.py
@@ -1,7 +1,7 @@
from django.contrib import admin
from utils.widgets import LGEntryForm
-from .models import Publication, Editor, Pitch, Section
+from .models import Publication, Editor, Pitch, Section, PitchIdea
@admin.register(Publication)
@@ -54,6 +54,18 @@ class PitchAdmin(admin.ModelAdmin):
)
+@admin.register(PitchIdea)
+class PitchIdeaAdmin(admin.ModelAdmin):
+ list_display = ('title', )
+
+ fieldsets = (
+ ('', {
+ 'fields': ('title', 'pitch', 'publication'),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ )
+
+
@admin.register(Section)
class SectionAdmin(admin.ModelAdmin):
list_display = ('name',)
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()