aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-11-26 14:27:16 +0100
committerAlban Gruin2017-11-26 14:27:16 +0100
commit8cd40466e5b1ef9f00cf88c9375289d235abc009 (patch)
tree5b0c6ec8bbea4cf0fb8f22b60d95d6ab107e02f3 /views.py
parentef6f5e8517436b804265880b71a2ee88f9f5c179 (diff)
Optimisation de la requête utilisée pour savoir si il y a des cours
sur la semaine sélectionnée (utilisation de exists() au lieu de count())
Diffstat (limited to 'views.py')
-rw-r--r--views.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/views.py b/views.py
index 4431891..c647fac 100644
--- a/views.py
+++ b/views.py
@@ -77,7 +77,7 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
group = get_object_or_404(Group, slug=group_slug, timetable=timetable)
courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end)
- if courses.count() == 0 and provided_week:
+ if not courses.exists() and provided_week:
raise Http404
last_update = courses.aggregate(Max("last_update"))["last_update__max"]