aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/models.py b/models.py
index af136af..bc0ec2d 100644
--- a/models.py
+++ b/models.py
@@ -34,6 +34,9 @@ class LastUpdate(models.Model):
year = models.IntegerField(verbose_name="année")
date = models.DateTimeField(verbose_name="date de mise à jour")
+ def __str__(self):
+ return "{0}, semaine {1} de {2}".format(self.timetable.name, self.week, self.year)
+
class Meta:
unique_together = ("timetable", "week", "year",)
@@ -57,7 +60,7 @@ class Group(models.Model):
return self.timetable.id == timetable_id and self.mention == mention and self.subgroup == subgroup and (self.td == td or self.td is None or td is None) and (self.tp == tp or self.tp is None or tp is None)
def __str__(self):
- return self.name
+ return "{0} - {1}".format(self.timetable.name, self.name)
def save(self):
try:
@@ -95,6 +98,9 @@ class Subscription(models.Model):
active = models.BooleanField(verbose_name="activé", default=False, db_index=True)
token = models.CharField(max_length=64, unique=True, default="")
+ def __str__(self):
+ return "{0} - {1}".format(self.email, self.group)
+
def save(self):
if self.token == "":
self.token = hashlib.sha1(os.urandom(128)).hexdigest()
@@ -154,6 +160,10 @@ class Course(models.Model):
def __str__(self):
return self.name
+ def save(self):
+ self.type_.replace("COURS", "Cours")
+ super(Course, self).save()
+
class Meta:
verbose_name = "cours"