Fixed query.

This commit is contained in:
Tomas "Jethro" Pokorny 2018-09-14 17:54:47 +02:00
parent f495240701
commit 8ab43b9ae1

View file

@ -552,9 +552,8 @@ def aktivniResitele(rocnik,cislo):
if int(cislo) > 3:
problemy = Problem.objects.filter(cislo_zadani = letos.cisla)
else:
problemy = Problem.objects.filter(Q(cislo_zadani = letos.cisla)|Q(cislo_zadani=loni.cisla))
resitele = aktualni_resitele.filter(reseni = Reseni.objects.filter(problem=problemy)).distinct()
problemy = Problem.objects.filter(Q(cislo_zadani__in = letos.cisla)|Q(cislo_zadani__in = loni.cisla))
resitele = aktualni_resitele.filter(reseni__in = Reseni.objects.filter(problem__in=problemy)).distinct()
return resitele