diff options
author | Alban Gruin | 2019-08-30 13:59:13 +0200 |
---|---|---|
committer | Alban Gruin | 2019-09-01 13:28:32 +0200 |
commit | 683409424325e7048c802960e81585320904fac1 (patch) | |
tree | e752d9d9d4d24a45653af0bdd413f72618734d2b /models.py | |
parent | 0ad58a9268130e49c017f13beacb618f466a722f (diff) | |
parent | a85f2fb91d1a4a0e31c41c392e404d7ddbf21109 (diff) |
Merge branch 'ag/parser-ups-2019' into futur
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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 @@ -268,6 +274,7 @@ class Course(models.Model): if self.type is not None: self.type = self.type.replace("COURS", "cours") self.type = self.type.replace("REUNION", "réunion") + self.type = self.type.replace("RENCONTRE", "rencontre") if self.name is not None: self.name = self.name.split("(")[0].strip() |