Status opravy řešit přes enum
This commit is contained in:
		
							parent
							
								
									9df34c22e0
								
							
						
					
					
						commit
						8d09fd5389
					
				
					 2 changed files with 10 additions and 25 deletions
				
			
		|  | @ -132,23 +132,23 @@ | |||
|             <img src="{% static "korektury/imgs/delete.png"%}"/> | ||||
| 					</button> | ||||
| 					{% endif %}  | ||||
| 					{% if o.status != 'k_oprave' %} | ||||
| 					<button type='submit' name='action' value='undone' title='Označ jako neopravené'> | ||||
| 					{% if o.status != o.STATUS.K_OPRAVE %} | ||||
| 					<button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'> | ||||
|             <img src="{% static "korektury/imgs/undo.png"%}"/> | ||||
| 					</button> | ||||
| 					{% endif %} | ||||
| 					{% if o.status != 'opraveno' %} | ||||
| 					<button type='submit' name='action' value='done' title='Označ jako opravené'> | ||||
| 					{% if o.status != o.STATUS.OPRAVENO %} | ||||
| 					<button type='submit' name='action' value='{{ o.STATUS.OPRAVENO }}' title='Označ jako opravené'> | ||||
|             <img src="{% static "korektury/imgs/check.png"%}"/> | ||||
| 					</button> | ||||
| 					{% endif %} | ||||
| 					{% if o.status != 'neni_chyba' %}  | ||||
| 					<button type='submit' name='action' value='wontfix' title='Označ, že se nebude měnit'> | ||||
| 					{% if o.status != o.STATUS.NENI_CHYBA %}  | ||||
| 					<button type='submit' name='action' value='{{ o.STATUS.NENI_CHYBA }}' title='Označ, že se nebude měnit'> | ||||
|             <img src="{% static "korektury/imgs/cross.png" %}"/> | ||||
| 					</button> | ||||
| 					{% endif %} | ||||
| 					{% if o.status != 'k_zaneseni' %}  | ||||
| 					<button type='submit' name='action' value='ready' title='Označ jako připraveno k zanesení'> | ||||
| 					{% if o.status != o.STATUS.K_ZANESENI %}  | ||||
| 					<button type='submit' name='action' value='{{ o.STATUS.K_ZANESENI }}' title='Označ jako připraveno k zanesení'> | ||||
|             <img src="{% static "korektury/imgs/tex.png" %}"/> | ||||
| 					</button> | ||||
| 					{% endif %} | ||||
|  |  | |||
|  | @ -94,25 +94,10 @@ class KorekturyView(generic.TemplateView): | |||
| 			op.autor = autor | ||||
| 			op.text = text | ||||
| 			op.save() | ||||
| 		elif (action == 'undone'): | ||||
| 		elif action in Oprava.STATUS.values: | ||||
| 			id = int(q.get('id')) | ||||
| 			op = Oprava.objects.get(id=id) | ||||
| 			op.status = op.STATUS.K_OPRAVE | ||||
| 			op.save() | ||||
| 		elif (action == 'done'): | ||||
| 			id = int(q.get('id')) | ||||
| 			op = Oprava.objects.get(id=id) | ||||
| 			op.status = op.STATUS.OPRAVENO | ||||
| 			op.save() | ||||
| 		elif (action == 'ready'): | ||||
| 			id = int(q.get('id')) | ||||
| 			op = Oprava.objects.get(id=id) | ||||
| 			op.status = op.STATUS.K_ZANESENI | ||||
| 			op.save() | ||||
| 		elif (action == 'wontfix'): | ||||
| 			id = int(q.get('id')) | ||||
| 			op = Oprava.objects.get(id=id) | ||||
| 			op.status = op.STATUS.NENI_CHYBA | ||||
| 			op.status = action | ||||
| 			op.save() | ||||
| 		elif (action == 'comment'): | ||||
| 			id = int(q.get('id')) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue