diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -84,7 +84,7 @@ class GroupManager(Manager): timetable=group.timetable) -class Group(models.Model): +class Group(SlugModel): objects = GroupManager() name = models.CharField(max_length=255, verbose_name="nom") @@ -121,7 +121,6 @@ class Group(models.Model): def save(self, *args, **kwargs): if self.name == "": self.name = self.celcat_name - self.slug = slugify(self.name) self.mention, self.semester, self.subgroup = parse_group(self.name) if self.subgroup is None: @@ -140,17 +139,13 @@ class Group(models.Model): verbose_name_plural = "groupes" -class Room(models.Model): +class Room(SlugModel): name = models.CharField(max_length=255, unique=True, verbose_name="nom") slug = models.SlugField(max_length=64, default="", unique=True) def __str__(self): return self.name - def save(self, *args, **kwargs): - self.slug = slugify(self.name) - super(Room, self).save() - class Meta: verbose_name = "salle" verbose_name_plural = "salles" |