diff options
author | Alban Gruin | 2017-11-26 14:08:11 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-26 14:08:11 +0100 |
commit | 2aacb6e59e40c9d47d02719dc7b5541a36b3c9ed (patch) | |
tree | 8f5cedbe9d1a9a60fdb3fd8cf2a0b8176517226e /models.py | |
parent | f8c7775aac4a7eb2a4430d1aabb20b7f29939af7 (diff) |
Correction d’un cas pouvant provoquer une erreur de parsage de
groupe (si jamais il n’y a pas de semestre), renvoi du numéro de
semestre dans group_info, adaptation de corresponds_to.
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -101,7 +101,7 @@ class Group(models.Model): hidden = models.BooleanField(verbose_name="caché", default=False) - def corresponds_to(self, mention, subgroup): + def corresponds_to(self, mention, semester, subgroup): subgroup_corresponds = True if self.subgroup is not None and subgroup is not None: subgroup_corresponds = self.subgroup.startswith(subgroup) @@ -109,11 +109,12 @@ class Group(models.Model): # TODO adapter pour semester return (self.mention.startswith(mention) or \ mention.startswith(self.mention)) and \ + (self.semester == semester or semester is None) and \ subgroup_corresponds @property def group_info(self): - return self.mention, self.subgroup + return self.mention, self.semester, self.subgroup def __str__(self): return self.name |