aboutsummaryrefslogtreecommitdiff
path: root/admin.py
blob: 233ed1dd4ea0d1562e64bb80429f5e15f0e596bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from django.contrib import admin
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):
    fieldsets = (
        (None, {"fields": ("name", "timetable",)}),
        ("Groupes", {"fields": ("mention", "subgroup", "td", "tp",)}),)
    list_display = ("name", "timetable",)
    list_filter = ("timetable__name",)
    readonly_fields = ("mention", "subgroup", "td", "tp",)


@admin.register(Room)
class RoomAdmin(admin.ModelAdmin):
    pass


@admin.register(Course)
class CourseAdmin(admin.ModelAdmin):
    fieldsets = (
        (None, {"fields": ("name", "type", "timetable", "groups", "rooms",)}),
        ("Horaires", {"fields": ("begin", "end",)}),
        ("Remarques", {"fields": ("notes",)}),)
    list_display = ("name", "type", "timetable", "begin", "end",)
    list_filter = ("type", "timetable__name", "groups",)
    ordering = ("begin",)