aboutsummaryrefslogtreecommitdiff
path: root/models.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-17 21:20:37 +0100
committerAlban Gruin2017-11-27 12:11:30 +0100
commit1b0fbf29a484b16de31ac5df1b3fded39be95e97 (patch)
tree7b88adf996cb32494aa4c29e3aeecd5ee6c0778c /models.py
parentb219f1248fa84eb2b015a5a04f80905dad8904ae (diff)
Ajout d’un champ slug au modèle des salles
Diffstat (limited to 'models.py')
-rw-r--r--models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/models.py b/models.py
index 035bd6d..547c0e1 100644
--- a/models.py
+++ b/models.py
@@ -142,10 +142,14 @@ class Group(models.Model):
class Room(models.Model):
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"