aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin.py4
-rw-r--r--models.py12
2 files changed, 11 insertions, 5 deletions
diff --git a/admin.py b/admin.py
index 5350aad..527b1eb 100644
--- a/admin.py
+++ b/admin.py
@@ -38,7 +38,7 @@ class YearAdmin(admin.ModelAdmin):
@admin.register(Source)
class SourceAdmin(admin.ModelAdmin):
- list_display = ("url", "last_update_date",)
+ list_display = ("url", "metadata", "last_update_date",)
@admin.register(Timetable)
@@ -75,7 +75,7 @@ class CourseAdmin(admin.ModelAdmin):
(None, {"fields": ("name", "type", "source", "groups", "rooms",)}),
("Horaires", {"fields": ("begin", "end",)}),
("Remarques", {"fields": ("notes",)}),
- ("Avancé", {"fields": ("celcat_id", "last_update",),
+ ("Avancé", {"fields": ("celcat_id", "last_update", "buggy",),
"classes": ("collapse",)}),)
list_display = ("name", "type", "source", "begin", "end",)
list_filter = ("type", "source__timetables", "groups",)
diff --git a/models.py b/models.py
index b59f2d8..7fd5b3e 100644
--- a/models.py
+++ b/models.py
@@ -48,13 +48,15 @@ class Year(SlugModel):
class Source(models.Model):
- url = models.URLField(max_length=255, verbose_name="URL", unique=True)
+ url = models.URLField(max_length=255, verbose_name="URL")
+ metadata = models.CharField(max_length=256, verbose_name="Métadonnée",
+ blank=True, null=True)
last_update_date = models.DateTimeField(null=True, blank=True,
verbose_name="dernière mise à jour"
" Celcat")
def __str__(self):
- return self.url
+ return "{}, {}".format(self.url, self.metadata)
@property
def formatted_timetables(self):
@@ -62,6 +64,7 @@ class Source(models.Model):
self.timetables.all()])
class Meta:
+ unique_together = (("url", "metadata",),)
verbose_name = "source d’emploi du temps"
verbose_name_plural = "sources d’emploi du temps"
@@ -258,9 +261,12 @@ class Course(models.Model):
last_update = models.DateTimeField(verbose_name="dernière mise à jour",
default=timezone.now)
- celcat_id = models.IntegerField(verbose_name="ID Celcat", null=True)
+ celcat_id = models.CharField(max_length=64, verbose_name="ID Celcat",
+ null=True)
module = models.ForeignKey(Module, on_delete=models.SET_NULL, null=True)
+ buggy = models.BooleanField(verbose_name="Bogué", default=False)
+
def __str__(self):
return self.name