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