|
|
@ -11,10 +11,10 @@ from .forms import OpravaForm |
|
|
|
class KorekturyListView(generic.ListView): |
|
|
|
model = KorekturovanePDF |
|
|
|
queryset = KorekturovanePDF.objects.annotate( |
|
|
|
k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_oprave')), |
|
|
|
opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='opraveno')), |
|
|
|
neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='neni_chyba')), |
|
|
|
k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_zaneseni')), |
|
|
|
k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_OPRAVE)), |
|
|
|
opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_OPRAVENO)), |
|
|
|
neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_NENI_CHYBA)), |
|
|
|
k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_ZANESENI)), |
|
|
|
) |
|
|
|
template_name = 'korektury/seznam.html' |
|
|
|
|
|
|
@ -133,12 +133,7 @@ class KorekturyView(generic.TemplateView): |
|
|
|
kom.delete() |
|
|
|
elif (action == 'set-state'): |
|
|
|
pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) |
|
|
|
if (q.get('state') == 'adding'): |
|
|
|
pdf.status = pdf.STATUS_PRIDAVANI |
|
|
|
elif (q.get('state') == 'comitting'): |
|
|
|
pdf.status = pdf.STATUS_ZANASENI |
|
|
|
elif (q.get('state') == 'deprecated'): |
|
|
|
pdf.status = pdf.STATUS_ZASTARALE |
|
|
|
pdf.status = q.get('state') # FIXME odchytávat blbosti? |
|
|
|
pdf.save() |
|
|
|
context = self.get_context_data() |
|
|
|
context['scroll'] = scroll |
|
|
|