Odevzdávátko: omezení na letošní problémy
This commit is contained in:
parent
dc68d9d83a
commit
224a5e5d23
2 changed files with 7 additions and 1 deletions
|
@ -60,6 +60,7 @@ class CisloAdmin(admin.ModelAdmin):
|
|||
for cislo in queryset:
|
||||
cn = m.CisloNode.objects.get(cislo=cislo)
|
||||
for ch in tl.all_children(cn):
|
||||
print(ch)
|
||||
if isinstance(ch, m.TemaVCisleNode):
|
||||
if ch.tema.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
ch.tema.stav = m.Problem.STAV_ZADANY
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.views.generic.detail import SingleObjectMixin
|
|||
from django.shortcuts import redirect, get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
|
@ -71,6 +72,11 @@ class TabulkaOdevzdanychReseniView(ListView):
|
|||
|
||||
# Filtrujeme!
|
||||
aktualni_rocnik = m.Nastaveni.get_solo().aktualni_rocnik # .get_solo() vrátí tu jedinou instanci
|
||||
|
||||
# Chceme jen letošní problémy
|
||||
# FIXME: Neexistuje metoda, jak dostat starší problémy…
|
||||
self.problemy = self.problemy.filter(Q(Tema___rocnik=aktualni_rocnik) | Q(Uloha___cislo_zadani__rocnik = aktualni_rocnik) | Q(Clanek___cislo__rocnik = aktualni_rocnik) | Q(Konfera___soustredeni__rocnik = aktualni_rocnik))
|
||||
|
||||
self.chteni_resitele = resitele # Zapamatování pro get_context_data
|
||||
if resitele == FiltrForm.RESITELE_RELEVANTNI:
|
||||
# TODO: Zkontrolovat, že resi_v_rocniku vrací QuerySet (jinak asi bude žrát spoustu zdrojů zbytečně)
|
||||
|
@ -80,7 +86,6 @@ class TabulkaOdevzdanychReseniView(ListView):
|
|||
|
||||
if problemy == FiltrForm.PROBLEMY_MOJE:
|
||||
org = m.Organizator.objects.get(osoba__user=self.request.user)
|
||||
from django.db.models import Q
|
||||
self.problemy = self.problemy.filter(Q(autor=org)|Q(garant=org)|Q(opravovatele=org), stav=m.Problem.STAV_ZADANY)
|
||||
elif problemy == FiltrForm.PROBLEMY_LETOSNI:
|
||||
self.problemy = self.problemy.filter(stav=m.Problem.STAV_ZADANY)
|
||||
|
|
Loading…
Reference in a new issue