aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py2
-rw-r--r--views.py11
2 files changed, 6 insertions, 7 deletions
diff --git a/models.py b/models.py
index fe285ac..db9e262 100644
--- a/models.py
+++ b/models.py
@@ -151,7 +151,7 @@ class CourseManager(Manager):
def get_courses_for_group(self, group, **criteria):
groups_criteria = reduce(lambda x, y: x | y,
[Q(groups__subgroup=group.subgroup[:i])
- for i in range(1, len(group.subgroup))]) | \
+ for i in range(1, len(group.subgroup) + 1)]) | \
Q(groups__subgroup__isnull=True)
return self.get_queryset() \
diff --git a/views.py b/views.py
index 2100972..e5c89a2 100644
--- a/views.py
+++ b/views.py
@@ -39,13 +39,12 @@ def group_list_common(request, timetable, groups):
groups_weeks = Course.objects.get_weeks(begin__gte=start, begin__lt=end, timetable=timetable) \
.values("groups__mention", "groups__subgroup",
- "groups__td", "groups__tp", "year", "week")
+ "year", "week")
for group in groups:
for group_week in groups_weeks:
if group.corresponds_to(timetable.id, group_week["groups__mention"],
- group_week["groups__subgroup"], group_week["groups__td"],
- group_week["groups__tp"]):
+ group_week["groups__subgroup"]):
if not hasattr(group, "weeks"):
group.weeks = []
@@ -60,7 +59,7 @@ def group_list_common(request, timetable, groups):
def group_list(request, year_slug, timetable_slug):
timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
- groups = Group.objects.get_relevant_groups(timetable=timetable).order_by("name")
+ groups = Group.objects.filter(timetable=timetable).order_by("name")
return group_list_common(request, timetable, groups)
def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=None):
@@ -78,8 +77,8 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
group = get_object_or_404(Group, slug=group_slug, timetable=timetable)
- if group.children.count():
- return group_list_common(request, timetable, Group.objects.get_relevant_children(group))
+ # if group.children.count():
+ # return group_list_common(request, timetable, Group.objects.get_relevant_children(group))
courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end)
if courses.count() == 0 and provided_week: