Commit c749ea36 authored by Isaiah Flores's avatar Isaiah Flores

Update widget_group3/widget_group3/admin.py

parent 77b7d1ee
...@@ -4,8 +4,8 @@ from .models import WidgetUser, Post, Reply, Announcement, Assignment, Departmen ...@@ -4,8 +4,8 @@ from .models import WidgetUser, Post, Reply, Announcement, Assignment, Departmen
# Classes # Classes
class DepartmentInline(admin.TabularInline): class WidgetUserInline(admin.TabularInline):
model = Department model = WidgetUser
class WidgetUserAdmin(admin.ModelAdmin): class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser model = WidgetUser
...@@ -23,11 +23,24 @@ class WidgetUserAdmin(admin.ModelAdmin): ...@@ -23,11 +23,24 @@ class WidgetUserAdmin(admin.ModelAdmin):
}), }),
] ]
inlines = [DepartmentInline,]
class DepartmentAdmin(admin.ModelAdmin): class DepartmentAdmin(admin.ModelAdmin):
model = Department model = Department
search_fields = ('dept_name', 'home_unit')
list_display = ('dept_name', 'home_unit')
list_filter = ('dept_name', 'home_unit')
fieldsets = [
('Department Data', {
'fields': [
'dept_name',
'home_unit',
]
}),
]
inlines = [WidgetUserInline,]
class AnnouncementAdmin(admin.ModelAdmin): class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement model = Announcement
...@@ -115,3 +128,4 @@ admin.site.register(Post, PostAdmin) ...@@ -115,3 +128,4 @@ admin.site.register(Post, PostAdmin)
admin.site.register(Reply, ReplyAdmin) admin.site.register(Reply, ReplyAdmin)
admin.site.register(Announcement, AnnouncementAdmin) admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Assignment, AssignmentAdmin) admin.site.register(Assignment, AssignmentAdmin)
admin.site.register(Department, DepartmentAdmin)
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