aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-11-27 15:25:42 +0100
committerAlban Gruin2017-11-27 15:25:42 +0100
commitf729db8ed67f4540eb265e848bcd71add3ff074e (patch)
treee6e55497ebf9520594d408577459e276a0848a61
parent582b1d2be865cc0fba9aa4726404f4370d0b80c5 (diff)
Renommage de Timetable en Source et de TimetableFront en Timetable.
C’est à partir de ce commit que la migration fournie sur la ML est utilisable.
-rw-r--r--admin.py10
-rw-r--r--models.py11
2 files changed, 10 insertions, 11 deletions
diff --git a/admin.py b/admin.py
index 717a386..9d8a34f 100644
--- a/admin.py
+++ b/admin.py
@@ -14,7 +14,7 @@
# along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin
-from .models import Course, Group, Room, Timetable, TimetableFront, Year
+from .models import Course, Group, Room, Source, Timetable, Year
def make_hidden(modeladmin, request, queryset):
queryset.update(hidden=True)
@@ -32,13 +32,13 @@ class YearAdmin(admin.ModelAdmin):
ordering = ("name",)
-@admin.register(Timetable)
-class TimetableAdmin(admin.ModelAdmin):
+@admin.register(Source)
+class SourceAdmin(admin.ModelAdmin):
list_display = ("url", "last_update_date",)
-@admin.register(TimetableFront)
-class TimetableFrontAdmin(admin.ModelAdmin):
+@admin.register(Timetable)
+class TimetableAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
list_display = ("name", "year", "source",)
list_filter = ("year__name",)
diff --git a/models.py b/models.py
index dc9732b..c55bbae 100644
--- a/models.py
+++ b/models.py
@@ -31,7 +31,6 @@ class SlugModel(models.Model):
super(SlugModel, self).save()
-
class Meta:
abstract = True
@@ -49,7 +48,7 @@ class Year(SlugModel):
verbose_name_plural = "années"
-class Timetable(models.Model):
+class Source(models.Model):
url = models.URLField(max_length=255, verbose_name="URL", unique=True)
last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat",
null=True, blank=True)
@@ -63,12 +62,12 @@ class Timetable(models.Model):
verbose_name_plural = "sources d’emploi du temps"
-class TimetableFront(SlugModel):
+class Timetable(SlugModel):
year = models.ForeignKey(Year, on_delete=models.CASCADE,
verbose_name="année")
name = models.CharField(max_length=64, verbose_name="nom")
slug = models.SlugField(max_length=64, default="")
- source = models.ForeignKey(Timetable, on_delete=models.CASCADE,
+ source = models.ForeignKey(Source, on_delete=models.CASCADE,
verbose_name="source")
def __str__(self):
@@ -102,7 +101,7 @@ 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(Timetable, on_delete=models.CASCADE,
+ timetable = models.ForeignKey(Source, on_delete=models.CASCADE,
verbose_name="emploi du temps")
mention = models.CharField(max_length=128)
@@ -190,7 +189,7 @@ 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(Timetable, on_delete=models.CASCADE,
+ timetable = models.ForeignKey(Source, on_delete=models.CASCADE,
verbose_name="emploi du temps")
notes = models.TextField(verbose_name="remarques", blank=True, null=True)