Nepoužívat náhodné stringy, když už máme nějaké definované…
This commit is contained in:
		
							parent
							
								
									c1440687aa
								
							
						
					
					
						commit
						1e6e6118a7
					
				
					 2 changed files with 8 additions and 13 deletions
				
			
		|  | @ -85,11 +85,11 @@ | |||
| 		{% csrf_token %} | ||||
| 		<input type='hidden' name='action' value='set-state'/> | ||||
| 		<input type='hidden' name='pdf' value='{{pdf.id}}'/> | ||||
| 		<input type="radio" name="state" value="adding" {% if pdf.status == 'pridavani' %} checked {% endif %}>Přidávání korektur | ||||
| 		<input type="radio" name="state" value="{{ pdf.STATUS_PRIDAVANI }}" {% if pdf.status == pdf.STATUS_PRIDAVANI %} checked {% endif %}>Přidávání korektur | ||||
| 		<br> | ||||
| 		<input type="radio" name="state" value="comitting" {% if pdf.status == 'zanaseni' %} checked {% endif %}>Zanášení korektur | ||||
| 		<input type="radio" name="state" value="{{ pdf.STATUS_ZANASENI }}" {% if pdf.status == pdf.STATUS_ZANASENI %} checked {% endif %}>Zanášení korektur | ||||
| 		<br> | ||||
| 		<input type="radio" name="state" value="deprecated" {%	if pdf.status == 'zastarale' %} checked {% endif %}>Zastaralé, nekorigovat | ||||
| 		<input type="radio" name="state" value="{{ pdf.STATUS_ZASTARALE }}" {%	if pdf.status == pdf.STATUS_ZASTARALE %} checked {% endif %}>Zastaralé, nekorigovat | ||||
| 		<br> | ||||
| 		<input type='submit' value='Změnit stav PDF'/> | ||||
| 	</form> | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue