From cb0c4d8588599027012855e0637fc76b23ac39c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 11 Feb 2018 17:55:15 +0100 Subject: [PATCH] Fix admin for Info. --- src/info/admin.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/info/admin.py b/src/info/admin.py index e8b9235a..028c25aa 100644 --- a/src/info/admin.py +++ b/src/info/admin.py @@ -1,6 +1,22 @@ from django.contrib import admin from .models import * -admin.site.register(InfoCategory) -admin.site.register(InfoItem) +@admin.register(InfoItem) +class InfoItemAdmin(admin.ModelAdmin): + list_filter = ['category', 'category__camp',] + list_display = ['headline',] + + +class InfoItemInlineAdmin(admin.StackedInline): + model = InfoItem + list_filter = ['category', 'category__camp',] + list_display = ['headline',] + + +@admin.register(InfoCategory) +class InfoCategorydmin(admin.ModelAdmin): + list_filter = ['camp',] + list_display = ['headline',] + search_fields = ['headline', 'body'] + inlines = [InfoItemInlineAdmin]