aboutsummaryrefslogtreecommitdiff
path: root/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'models.py')
-rw-r--r--models.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/models.py b/models.py
index 106e3f7..743ef03 100644
--- a/models.py
+++ b/models.py
@@ -1,4 +1,5 @@
from django.db import models
+from django.utils.text import slugify
class Timetable(models.Model):
@@ -24,6 +25,8 @@ class Group(models.Model):
td = models.IntegerField(verbose_name="groupe de TD", null=True, db_index=True)
tp = models.IntegerField(verbose_name="groupe de TP", null=True, db_index=True)
+ slug = models.SlugField(max_length=64, unique=True, default="")
+
def __str__(self):
return self.name
@@ -42,6 +45,7 @@ class Group(models.Model):
except:
print("Malformed name: {0}. Ignoring".format(self.name))
finally:
+ self.slug = slugify(self.name)
super(Group, self).save()
@@ -64,9 +68,10 @@ class Room(models.Model):
class Course(models.Model):
- name = models.CharField(max_length=255, verbose_name="nom")
- type_ = models.CharField(name="type", max_length=255, verbose_name="type de cours")
+ name = models.CharField(max_length=255, verbose_name="nom", null=True)
+ type_ = models.CharField(name="type", max_length=255, verbose_name="type de cours", null=True)
timetable = models.ForeignKey(Timetable, on_delete=models.CASCADE, verbose_name="emploi du temps")
+ notes = models.TextField(verbose_name="remarques", blank=True, null=True)
groups = models.ManyToManyField(Group, verbose_name="groupes")
rooms = models.ManyToManyField(Room, verbose_name="salles")