Commit 128cf48c authored by Almira Redoble's avatar Almira Redoble

Implemented Admin Panel

parent 4ffca08f
from django.contrib import admin
from .models import Department, WidgetUser
# Register your models here.
class WidgetUserInline(admin.TabularInline):
model = WidgetUser
class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser
list_display = ('last_name', 'first_name', 'department')
search_fields = ('last_name', 'first_name', 'department')
list_filter = ('last_name', 'department')
fieldsets = [
('Name', {
'fields':
(('last_name', 'first_name'), 'middle_name', 'department',),
}),
]
class DepartmentAdmin(admin.ModelAdmin):
model = Department
search_fields = ('dept_name', 'home_unit')
list_filter = ('home_unit', )
fieldsets = [
('Details', {
'fields':
(('dept_name', 'home_unit'),),
}),
]
inlines = [WidgetUserInline, ]
admin.site.register(Department, DepartmentAdmin)
admin.site.register(WidgetUser, WidgetUserAdmin)
......@@ -25,5 +25,3 @@ class WidgetUser(models.Model):
self.first_name,
self.middle_name
)
# Create your models here.
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