diff options
author | luxagraf <sng@luxagraf.net> | 2019-01-31 08:42:56 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-01-31 08:42:56 -0600 |
commit | 54806ef2b80af51c682553f4ef53f021c8f82160 (patch) | |
tree | fe3ab1669350a6678d960b90897dd6b4d872593b /app/publications/admin.py | |
parent | 2f7249b1cc40834752471f8b688084b139f0976c (diff) |
added pitch tracking system and taxonomy system across models
Diffstat (limited to 'app/publications/admin.py')
-rw-r--r-- | app/publications/admin.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/app/publications/admin.py b/app/publications/admin.py new file mode 100644 index 0000000..a09e7d5 --- /dev/null +++ b/app/publications/admin.py @@ -0,0 +1,65 @@ +from django.contrib import admin +from utils.widgets import LGEntryForm + +from .models import Publication, Editor, Pitch, Section + + +@admin.register(Publication) +class PublicationAdmin(admin.ModelAdmin): + form = LGEntryForm + list_display = ('name', 'status') + list_filter = ('status',) + search_fields = ['name'] + fieldsets = ( + ('', { + 'fields': ('name', 'notes', '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(Section) +class SectionAdmin(admin.ModelAdmin): + list_display = ('name',) + fieldsets = ( + ('', { + 'fields': ('name',), + 'classes': ('show', 'extrapretty', 'wide') + }), + ) |