From 92445132fe7a3d2fc05c9aca729c35da29f376cd Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 21 Jan 2016 16:22:19 -0700 Subject: [PATCH] Customizing projects admin --- ccdb/projects/admin.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ccdb/projects/admin.py b/ccdb/projects/admin.py index 148d8a5..c9f8232 100644 --- a/ccdb/projects/admin.py +++ b/ccdb/projects/admin.py @@ -3,6 +3,21 @@ from django.contrib import admin from .models import Project, Grant, GrantReport -admin.site.register(Project) +class ProjectGrantInline(admin.TabularInline): + model = Grant.projects.through + extra = 1 + + +class ProjectAdmin(admin.ModelAdmin): + list_display = ('id', 'name', 'code', 'iacuc_number', 'description', 'sort_order') + list_display_links = ('id', 'name') + search_fields = ('name', 'code', 'iacuc_number', 'description') + list_per_page = 25 + fields = ('name', 'code', 'iacuc_number', 'description', 'sort_order') + + inlines = [ProjectGrantInline] + + +admin.site.register(Project, ProjectAdmin) admin.site.register(Grant) admin.site.register(GrantReport)