aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py11
-rw-r--r--tests.py14
-rw-r--r--views.py2
3 files changed, 13 insertions, 14 deletions
diff --git a/models.py b/models.py
index bde27a7..59301e0 100644
--- a/models.py
+++ b/models.py
@@ -98,19 +98,18 @@ class Group(models.Model):
hidden = models.BooleanField(verbose_name="caché", default=False)
- def corresponds_to(self, timetable_id, mention, subgroup):
+ def corresponds_to(self, mention, subgroup):
subgroup_corresponds = True
if self.subgroup is not None and subgroup is not None:
subgroup_corresponds = self.subgroup.startswith(subgroup)
- return self.timetable.id == timetable_id and \
- (self.mention.startswith(mention) or \
- mention.startswith(self.mention)) and \
- subgroup_corresponds
+ return (self.mention.startswith(mention) or \
+ mention.startswith(self.mention)) and \
+ subgroup_corresponds
@property
def group_info(self):
- return self.timetable.id, self.mention, self.subgroup
+ return self.mention, self.subgroup
def __str__(self):
return self.name
diff --git a/tests.py b/tests.py
index e7af6a8..77fa120 100644
--- a/tests.py
+++ b/tests.py
@@ -152,12 +152,12 @@ class GroupTestCase(TestCase):
general = Group.objects.get(celcat_name="L1 info (toutes sections et semestres confondus)", timetable=self.timetable)
- self.assertEqual(cma.group_info, (self.timetable.id, "L1 info s2 ", "A"))
- self.assertEqual(tda2.group_info, (self.timetable.id, "L1 info s2 ", "A2"))
- self.assertEqual(tpa21.group_info, (self.timetable.id, "L1 info s2 ", "A21"))
+ self.assertEqual(cma.group_info, ("L1 info s2 ", "A"))
+ self.assertEqual(tda2.group_info, ("L1 info s2 ", "A2"))
+ self.assertEqual(tpa21.group_info, ("L1 info s2 ", "A21"))
- self.assertEqual(cmb.group_info, (self.timetable.id, "L1 info s2 ", "B"))
- self.assertEqual(tdb2.group_info, (self.timetable.id, "L1 info s2 ", "B2"))
- self.assertEqual(tpb21.group_info, (self.timetable.id, "L1 info s2 ", "B21"))
+ self.assertEqual(cmb.group_info, ("L1 info s2 ", "B"))
+ self.assertEqual(tdb2.group_info, ("L1 info s2 ", "B2"))
+ self.assertEqual(tpb21.group_info, ("L1 info s2 ", "B21"))
- self.assertEqual(general.group_info, (self.timetable.id, "L1 info ", ""))
+ self.assertEqual(general.group_info, ("L1 info ", ""))
diff --git a/views.py b/views.py
index 97d3048..7bc5641 100644
--- a/views.py
+++ b/views.py
@@ -45,7 +45,7 @@ def group_list_common(request, timetable, groups):
for group in groups:
for group_week in groups_weeks:
- if group.corresponds_to(timetable.id, group_week["groups__mention"],
+ if group.corresponds_to(group_week["groups__mention"],
group_week["groups__subgroup"]):
if not hasattr(group, "weeks"):
group.weeks = []