diff options
Diffstat (limited to 'admin.py')
-rw-r--r-- | admin.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -16,6 +16,14 @@ from django.contrib import admin from .models import Timetable, Group, Room, Course, Year +def make_hidden(modeladmin, request, queryset): + queryset.update(hidden=True) +make_hidden.short_description = "Cacher les groupes sélectionnés" + +def make_visible(modeladmin, request, queryset): + queryset.update(hidden=False) +make_visible.short_description = "Afficher les groupes sélectionnés" + @admin.register(Year) class YearAdmin(admin.ModelAdmin): @@ -35,12 +43,14 @@ class TimetableAdmin(admin.ModelAdmin): @admin.register(Group) class GroupAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "celcat_name", "timetable",)}), + (None, {"fields": ("name", "celcat_name", "timetable", "hidden",)}), ("Groupes", {"fields": ("mention", "subgroup", "td", "tp", "parent",)}),) - list_display = ("name", "timetable",) + list_display = ("name", "timetable", "hidden",) + list_editable = ("hidden",) list_filter = ("timetable",) ordering = ("timetable",) readonly_fields = ("celcat_name", "mention", "subgroup", "td", "tp",) + actions = (make_hidden, make_visible,) @admin.register(Room) |