From d0c69d3095d14f5509190d6b637cc0c018e53a19 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Mon, 27 Nov 2017 16:25:25 +0100 Subject: Changement des champs timetable en source pour plus de clareté --- admin.py | 14 +++++++------- models.py | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin.py b/admin.py index 9d8a34f..fc0ada1 100644 --- a/admin.py +++ b/admin.py @@ -48,12 +48,12 @@ class TimetableAdmin(admin.ModelAdmin): @admin.register(Group) class GroupAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "celcat_name", "timetable", "hidden",)}), + (None, {"fields": ("name", "celcat_name", "source", "hidden",)}), ("Groupes", {"fields": ("mention", "semester", "subgroup",)}),) - list_display = ("name", "timetable", "hidden",) + list_display = ("name", "source", "hidden",) list_editable = ("hidden",) - list_filter = ("timetable",) - ordering = ("timetable",) + list_filter = ("source__timetables",) + ordering = ("name", "source",) readonly_fields = ("celcat_name", "mention", "semester", "subgroup",) actions = (make_hidden, make_visible,) @@ -66,9 +66,9 @@ class RoomAdmin(admin.ModelAdmin): @admin.register(Course) class CourseAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "type", "timetable", "groups", "rooms", "last_update",)}), + (None, {"fields": ("name", "type", "source", "groups", "rooms", "last_update",)}), ("Horaires", {"fields": ("begin", "end",)}), ("Remarques", {"fields": ("notes",)}),) - list_display = ("name", "type", "timetable", "begin", "end",) - list_filter = ("type", "timetable", "groups",) + list_display = ("name", "type", "source", "begin", "end",) + list_filter = ("type", "source__timetables", "groups",) ordering = ("begin",) diff --git a/models.py b/models.py index eba8f1c..3c9fa27 100644 --- a/models.py +++ b/models.py @@ -101,8 +101,8 @@ class Group(SlugModel): name = models.CharField(max_length=255, verbose_name="nom") celcat_name = models.CharField(max_length=255, verbose_name="nom dans Celcat") - timetable = models.ForeignKey(Source, on_delete=models.CASCADE, - verbose_name="emploi du temps") + source = models.ForeignKey(Source, on_delete=models.CASCADE, + verbose_name="source d’emploi du temps") mention = models.CharField(max_length=128) semester = models.IntegerField(verbose_name="semestre", null=True) @@ -142,9 +142,9 @@ class Group(SlugModel): class Meta: index_together = ("mention", "semester", "subgroup",) - unique_together = (("name", "timetable",), - ("celcat_name", "timetable",), - ("slug", "timetable",),) + unique_together = (("name", "source",), + ("celcat_name", "source",), + ("slug", "source",),) verbose_name = "groupe" verbose_name_plural = "groupes" @@ -189,8 +189,8 @@ class Course(models.Model): name = models.CharField(max_length=255, verbose_name="nom", default="Sans nom") type_ = models.CharField(name="type", max_length=255, verbose_name="type de cours", null=True) - timetable = models.ForeignKey(Source, on_delete=models.CASCADE, - verbose_name="emploi du temps") + source = models.ForeignKey(Source, on_delete=models.CASCADE, + verbose_name="emploi du temps") notes = models.TextField(verbose_name="remarques", blank=True, null=True) groups = models.ManyToManyField(Group, verbose_name="groupes") -- cgit v1.2.1