Commit c0879735 authored by Agu Syquia's avatar Agu Syquia

Updated admin.py

Added a nested admin
parent c424c56f
from django.contrib import admin
from .models import Announcement, Reaction
class ReactionInline(admin.TabularInline):
model = Reaction
class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
search_fields = ('title', 'author',)
list_display = ('title', 'body', 'author', 'pub_datetime',)
list_filter = ('title', 'author', 'pub_datetime',)
inlines = [ReactionInline,]
class ReactionAdmin(admin.ModelAdmin):
model = Reaction
......@@ -15,5 +19,6 @@ class ReactionAdmin(admin.ModelAdmin):
list_display = ('name', 'tally', 'announcement',)
list_filter = ('name', 'tally',)
admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Reaction, ReactionAdmin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment