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"%}"/> |             <img src="{% static "korektury/imgs/delete.png"%}"/> | ||||||
| 					</button> | 					</button> | ||||||
| 					{% endif %}  | 					{% endif %}  | ||||||
| 					{% if o.status != 'k_oprave' %} | 					{% if o.status != o.STATUS.K_OPRAVE %} | ||||||
| 					<button type='submit' name='action' value='undone' title='Označ jako neopravené'> | 					<button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'> | ||||||
|             <img src="{% static "korektury/imgs/undo.png"%}"/> |             <img src="{% static "korektury/imgs/undo.png"%}"/> | ||||||
| 					</button> | 					</button> | ||||||
| 					{% endif %} | 					{% endif %} | ||||||
| 					{% if o.status != 'opraveno' %} | 					{% if o.status != o.STATUS.OPRAVENO %} | ||||||
| 					<button type='submit' name='action' value='done' title='Označ jako opravené'> | 					<button type='submit' name='action' value='{{ o.STATUS.OPRAVENO }}' title='Označ jako opravené'> | ||||||
|             <img src="{% static "korektury/imgs/check.png"%}"/> |             <img src="{% static "korektury/imgs/check.png"%}"/> | ||||||
| 					</button> | 					</button> | ||||||
| 					{% endif %} | 					{% endif %} | ||||||
| 					{% if o.status != 'neni_chyba' %}  | 					{% if o.status != o.STATUS.NENI_CHYBA %}  | ||||||
| 					<button type='submit' name='action' value='wontfix' title='Označ, že se nebude měnit'> | 					<button type='submit' name='action' value='{{ o.STATUS.NENI_CHYBA }}' title='Označ, že se nebude měnit'> | ||||||
|             <img src="{% static "korektury/imgs/cross.png" %}"/> |             <img src="{% static "korektury/imgs/cross.png" %}"/> | ||||||
| 					</button> | 					</button> | ||||||
| 					{% endif %} | 					{% endif %} | ||||||
| 					{% if o.status != 'k_zaneseni' %}  | 					{% if o.status != o.STATUS.K_ZANESENI %}  | ||||||
| 					<button type='submit' name='action' value='ready' title='Označ jako připraveno k zanesení'> | 					<button type='submit' name='action' value='{{ o.STATUS.K_ZANESENI }}' title='Označ jako připraveno k zanesení'> | ||||||
|             <img src="{% static "korektury/imgs/tex.png" %}"/> |             <img src="{% static "korektury/imgs/tex.png" %}"/> | ||||||
| 					</button> | 					</button> | ||||||
| 					{% endif %} | 					{% endif %} | ||||||
|  |  | ||||||
|  | @ -94,25 +94,10 @@ class KorekturyView(generic.TemplateView): | ||||||
| 			op.autor = autor | 			op.autor = autor | ||||||
| 			op.text = text | 			op.text = text | ||||||
| 			op.save() | 			op.save() | ||||||
| 		elif (action == 'undone'): | 		elif action in Oprava.STATUS.values: | ||||||
| 			id = int(q.get('id')) | 			id = int(q.get('id')) | ||||||
| 			op = Oprava.objects.get(id=id) | 			op = Oprava.objects.get(id=id) | ||||||
| 			op.status = op.STATUS.K_OPRAVE | 			op.status = action | ||||||
| 			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.save() | 			op.save() | ||||||
| 		elif (action == 'comment'): | 		elif (action == 'comment'): | ||||||
| 			id = int(q.get('id')) | 			id = int(q.get('id')) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue