summaryrefslogtreecommitdiff
path: root/bak/unused_apps/publications/admin.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/publications/admin.py
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/publications/admin.py')
-rw-r--r--bak/unused_apps/publications/admin.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/bak/unused_apps/publications/admin.py b/bak/unused_apps/publications/admin.py
new file mode 100644
index 0000000..15456d5
--- /dev/null
+++ b/bak/unused_apps/publications/admin.py
@@ -0,0 +1,85 @@
+from django.contrib import admin
+from utils.widgets import LGEntryForm
+
+from .models import Publication, Editor, Pitch, Section, PitchIdea
+
+
+@admin.register(Publication)
+class PublicationAdmin(admin.ModelAdmin):
+ form = LGEntryForm
+ list_display = ('name', 'status')
+ list_filter = ('status',)
+ search_fields = ['name']
+ fieldsets = (
+ ('', {
+ 'fields': (
+ 'name',
+ 'url',
+ 'notes',
+ ('section', 'tags'),
+ ('pays', 'pays_amount'),
+ ('submission_period_start', 'submission_period_end'),
+ 'status'
+ ),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ )
+
+
+@admin.register(Editor)
+class EditorAdmin(admin.ModelAdmin):
+ list_display = ('last_name', 'first_name', 'publication', 'sections')
+ list_filter = ('publication', 'section')
+ search_fields = ['first_name', 'last_name', 'publication__name', 'section']
+ filter_horizontal = ('section',)
+
+ def sections(self, obj):
+ return [section for section in obj.section.all()]
+ sections.boolean = False
+
+ fieldsets = (
+ ('', {
+ 'fields': ('first_name', 'last_name', 'email', 'publication', 'section', 'notes', 'phone', 'twitter'),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ )
+
+
+@admin.register(Pitch)
+class PitchAdmin(admin.ModelAdmin):
+ list_display = ('title', 'date_sent', 'accepted', 'editor', 'publication')
+ list_filter = ('editor__publication', 'editor__section')
+
+ def publication(self, obj):
+ return obj.editor.publication
+ publication.boolean = False
+
+ fieldsets = (
+ ('', {
+ 'fields': ('title', 'pitch', 'editor', 'accepted', 'date_sent'),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ )
+
+
+@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',)
+ fieldsets = (
+ ('', {
+ 'fields': ('name',),
+ 'classes': ('show', 'extrapretty', 'wide')
+ }),
+ )