diff options
Diffstat (limited to 'admin.py')
-rw-r--r-- | admin.py | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1,10 +1,17 @@ from django.contrib import admin -from edt.models import Group, Room, Course +from edt.models import Timetable, Group, Room, Course + + +@admin.register(Timetable) +class TimetableAdmin(admin.ModelAdmin): + prepopulated_fields = {"slug": ("name",)} + list_display = ("name", "url",) @admin.register(Group) class GroupAdmin(admin.ModelAdmin): - pass + list_display = ("name", "timetable",) + list_filter = ("timetable__name",) @admin.register(Room) @@ -15,7 +22,8 @@ class RoomAdmin(admin.ModelAdmin): @admin.register(Course) class CourseAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "type", "groups", "rooms",)}), + (None, {"fields": ("name", "type", "timetable", "groups", "rooms",)}), ("Horaires", {"fields": ("begin", "end",)}),) - list_display = ("name", "type", "begin", "end",) - list_filter = ("type", "groups",) + list_display = ("name", "type", "timetable", "begin", "end",) + list_filter = ("type", "timetable__name", "groups",) + ordering = ("begin",) |