diff options
author | Alban Gruin | 2017-09-07 17:02:27 +0200 |
---|---|---|
committer | Alban Gruin | 2017-09-07 17:02:27 +0200 |
commit | 1561cb829a48d49d36242db89fa4490144767065 (patch) | |
tree | 7bdfc702f0f23e07eb7cdd383a66aa47c10e6bbd /models.py | |
parent | 36757e937abd7d5aa3434f4c815dfb040e1e3a71 (diff) |
Séparation de l’année et de la mention dans le modèle Timetable
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -26,15 +26,21 @@ import os class Timetable(models.Model): - name = models.CharField(max_length=64, unique=True, verbose_name="nom") + year = models.CharField(max_length=16, verbose_name="année") + name = models.CharField(max_length=64, verbose_name="nom") url = models.URLField(max_length=255, unique=True, verbose_name="URL") slug = models.SlugField(max_length=64, unique=True, default="") def __str__(self): - return self.name + return self.full_name() + + def full_name(self): + return self.year + " " + self.name + full_name.short_description = "Nom complet" class Meta: + unique_together = ("year", "name",) verbose_name = "emploi du temps" verbose_name_plural = "emplois du temps" |