From 4b9ff291e35163b6d0ffcff78878e9ba23bf23dc Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Fri, 27 Jan 2017 21:40:24 +0100 Subject: Surcharge de l'opérateur in du modèle des groupes --- models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models.py b/models.py index 981d8fb..9bf5866 100644 --- a/models.py +++ b/models.py @@ -44,6 +44,9 @@ class Group(models.Model): slug = models.SlugField(max_length=64, unique=True, default="") + def __contains__(self, group): + return self.timetable == group.timetable and self.mention == group.mention and self.subgroup == group.subgroup and (self.td == group.td or self.td is None or group.td is None) and (self.tp == group.tp or self.tp is None or group.tp is None) + def __str__(self): return self.name -- cgit v1.2.1