diff options
author | Alban Gruin | 2017-10-03 09:28:49 +0200 |
---|---|---|
committer | Alban Gruin | 2017-10-03 09:28:49 +0200 |
commit | ae3358c1296a02352409910a9ffcc2307d5ea87a (patch) | |
tree | b47df3b99f639acc24d751cc0a6a73937c10069b /admin.py | |
parent | 9641fc9bb6ef2897c0d70e6d5d5ed3f8e295dbec (diff) | |
parent | 175fcd46f56d8c1c5d10a50b401c09c25cfcdf82 (diff) |
Merge branch 'stable/0.10.z' into prod/pa1ch/0.y.zv0.10.0-pa1ch
Diffstat (limited to 'admin.py')
-rw-r--r-- | admin.py | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -14,7 +14,15 @@ # along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. from django.contrib import admin -from .models import Timetable, LastUpdate, Group, Room, Course, Year +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) @@ -32,21 +40,17 @@ class TimetableAdmin(admin.ModelAdmin): ordering = ("year", "name",) -@admin.register(LastUpdate) -class LastUpdateAdmin(admin.ModelAdmin): - list_display = ("timetable", "week", "year", "date", "updated_at",) - list_filter = ("timetable__name",) - - @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) @@ -57,7 +61,7 @@ class RoomAdmin(admin.ModelAdmin): @admin.register(Course) class CourseAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "type", "timetable", "groups", "rooms",)}), + (None, {"fields": ("name", "type", "timetable", "groups", "rooms", "last_update",)}), ("Horaires", {"fields": ("begin", "end",)}), ("Remarques", {"fields": ("notes",)}),) list_display = ("name", "type", "timetable", "begin", "end",) |