Browse Source

Pridan pocet korektur k zobrazeni PDF.

export_seznamu_prednasek
parent
commit
1d3cb281ea
  1. 8
      korektury/templates/korektury/opraf.html
  2. 14
      korektury/views.py

8
korektury/templates/korektury/opraf.html

@ -26,22 +26,22 @@
id="k_oprave_checkbox" id="k_oprave_checkbox"
name="k_oprave_checkbox" name="k_oprave_checkbox"
onchange="toggle_corrections('k_oprave')" checked> onchange="toggle_corrections('k_oprave')" checked>
<label for="k_oprave_checkbox">K opravě</label> <label for="k_oprave_checkbox">K opravě ({{k_oprave_cnt}})</label>
<input type="checkbox" <input type="checkbox"
id="opraveno_checkbox" id="opraveno_checkbox"
name="opraveno_checkbox" name="opraveno_checkbox"
onchange="toggle_corrections('opraveno')" checked> onchange="toggle_corrections('opraveno')" checked>
<label for="opraveno_checkbox">Opraveno</label> <label for="opraveno_checkbox">Opraveno ({{opraveno_cnt}})</label>
<input type="checkbox" <input type="checkbox"
id="neni_chyba_checkbox" id="neni_chyba_checkbox"
name="neni_chyba_checkbox" name="neni_chyba_checkbox"
onchange="toggle_corrections('neni_chyba')" checked> onchange="toggle_corrections('neni_chyba')" checked>
<label for="neni_chyba_checkbox">Není chyba</labe> <label for="neni_chyba_checkbox">Není chyba ({{neni_chyba_cnt}})</labe>
<input type="checkbox" <input type="checkbox"
id="k_zaneseni_checkbox" id="k_zaneseni_checkbox"
name="k_zaneseni_checkbox" name="k_zaneseni_checkbox"
onchange="toggle_corrections('k_zaneseni')" checked> onchange="toggle_corrections('k_zaneseni')" checked>
<label for="k_zaneseni_checkbox">K opravě</labe> <label for="k_zaneseni_checkbox">K zanesení ({{k_zaneseni_cnt}})</labe>
<hr/> <hr/>

14
korektury/views.py

@ -5,6 +5,7 @@ from django.utils.translation import ugettext as _
from django.conf import settings from django.conf import settings
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from django.core.mail import send_mail from django.core.mail import send_mail
from django.db.models import Count,Q
from .models import Oprava,Komentar,KorekturovanePDF, Organizator from .models import Oprava,Komentar,KorekturovanePDF, Organizator
from .forms import OpravaForm from .forms import OpravaForm
@ -17,8 +18,16 @@ import unicodedata
class KorekturyHelpView(generic.TemplateView): class KorekturyHelpView(generic.TemplateView):
template_name = 'korektury/help.html' template_name = 'korektury/help.html'
class KorekturyListView(generic.ListView): class KorekturyListView(generic.ListView):
model = KorekturovanePDF model = KorekturovanePDF
# Nefunguje, filtry se vubec nepouziji
queryset = KorekturovanePDF.objects.annotate(
k_oprave_cnt=Count('oprava',filter=Q(oprava__status='k_oprave')),
opraveno_cnt=Count('oprava',filter=Q(oprava__status='opraveno')),
neni_chyba_cnt=Count('oprava',filter=Q(oprava__status='neni_chyba')),
k_zaneseni_cnt=Count('oprava',filter=Q(oprava__status='k_zaneseni')),
)
template_name = 'korektury/seznam.html' template_name = 'korektury/seznam.html'
### Korektury ### Korektury
@ -190,6 +199,11 @@ class KorekturyView(generic.TemplateView):
strany = set(o.strana for o in opravy) strany = set(o.strana for o in opravy)
opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany] opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany]
context['opravy_strany'] = opravy_na_stranu context['opravy_strany'] = opravy_na_stranu
context['k_oprave_cnt'] = opravy.filter(status='k_oprave').count()
context['opraveno_cnt'] = opravy.filter(status='opraveno').count()
context['neni_chyba_cnt'] = opravy.filter(status='neni_chyba').count()
context['k_zaneseni_cnt'] = opravy.filter(status='k_zaneseni').count()
context['opravy'] = opravy context['opravy'] = opravy
context['zasluhy'] = zasluhy context['zasluhy'] = zasluhy

Loading…
Cancel
Save