Browse Source

Tabulka odevzdaných řešení: filtr podle neobodovaných

middleware_test
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
303b6bab4a
  1. 2
      seminar/forms.py
  2. 1
      seminar/templates/seminar/odevzdavatko/tabulka.html
  3. 4
      seminar/views/odevzdavatko.py

2
seminar/forms.py

@ -404,6 +404,7 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form):
'problemy': cls.PROBLEMY_MOJE,
'reseni_od': terminy[-2],
'reseni_do': terminy[-1],
'neobodovane': False,
}
return initial
@ -426,3 +427,4 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form):
reseni_od = forms.DateField(input_formats=[DATE_FORMAT])
reseni_do = forms.DateField(input_formats=[DATE_FORMAT])
neobodovane = forms.BooleanField(required=False)

1
seminar/templates/seminar/odevzdavatko/tabulka.html

@ -9,6 +9,7 @@
{{ filtr.problemy }}
Od: {{ filtr.reseni_od }}
Do: {{ filtr.reseni_do }}
<span title="Jen neobodovaná řešení">🔨?</span> {{ filtr.neobodovane }}
<input type=submit value="→">
</form>

4
seminar/views/odevzdavatko.py

@ -59,12 +59,14 @@ class TabulkaOdevzdanychReseniView(ListView):
problemy = fcd["problemy"]
reseni_od = fcd["reseni_od"]
reseni_do = fcd["reseni_do"]
jen_neobodovane = fcd["neobodovane"]
else:
initial = FiltrForm.gen_initial()
resitele = initial['resitele']
problemy = initial['problemy']
reseni_od = initial['reseni_od'][0]
reseni_do = initial['reseni_do'][0]
jen_neobodovane = initial["neobodovane"]
# Filtrujeme!
@ -87,6 +89,8 @@ class TabulkaOdevzdanychReseniView(ListView):
self.problemy = self.problemy.non_polymorphic()
self.reseni = self.reseni.filter(cas_doruceni__date__gte=reseni_od, cas_doruceni__date__lte=reseni_do)
if jen_neobodovane:
self.reseni = self.reseni.filter(hodnoceni__body__isnull=True)
def get_queryset(self):
self.inicializuj_osy_tabulky()

Loading…
Cancel
Save