Customizing projects admin

This commit is contained in:
Matthew Ryan Dillon 2016-01-21 16:22:19 -07:00
parent d96487c943
commit 92445132fe

View file

@ -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)