Odevzdávátko: Filtrovat pouze odevzdatelná
This commit is contained in:
parent
ce4ee94fed
commit
fbcfe7e93f
1 changed files with 9 additions and 1 deletions
|
@ -386,7 +386,15 @@ class NahrajReseniNadproblemView(LoginRequiredMixin, ListView):
|
|||
template_name = 'odevzdavatko/nahraj_reseni_nadproblem.html'
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(nadproblem__isnull=True)
|
||||
# COPY PASTE z api/views/autocomplete.py TODO hodit někam do utils?
|
||||
nastaveni = get_object_or_404(m.Nastaveni)
|
||||
rocnik = nastaveni.aktualni_rocnik
|
||||
# Od tohoto místa dál jsem zkoušel spoustu variací podle https://django-polymorphic.readthedocs.io/en/stable/advanced.html
|
||||
temaQ = Q(Tema___rocnik=rocnik, stav=m.Problem.STAV_ZADANY)
|
||||
ulohaQ = Q(Uloha___cislo_zadani__rocnik=rocnik, stav=m.Problem.STAV_ZADANY)
|
||||
clanekQ = Q(Clanek___cislo__rocnik=rocnik, stav=m.Problem.STAV_ZADANY)
|
||||
qs = super().get_queryset().filter(temaQ | ulohaQ | clanekQ)
|
||||
return qs.filter(nadproblem__isnull=True)
|
||||
|
||||
|
||||
class NahrajReseniView(LoginRequiredMixin, CreateView):
|
||||
|
|
Loading…
Reference in a new issue