8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Résolution et réouverture des tickets

This commit is contained in:
Grizzly 2019-08-06 07:41:27 +00:00 committed by Gabriel Detraz
parent 1d60f62555
commit 209f118de2
3 changed files with 23 additions and 9 deletions

View file

@ -28,3 +28,10 @@ class EditPreferencesForm(ModelForm):
class Meta:
model = Preferences
fields = '__all__'
class ChangeStatusTicketForm(ModelForm):
""" Passe un Ticket en résolu """
class Meta:
model = Ticket
fields = []

View file

@ -54,14 +54,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<p><b>{% trans "Description" %}</b> {{ ticket.description }}</p>
<div class="text-right">
{% if not ticket.solved %}
<a class="btn btn-success" role="button">
<i class="fa fa-check"></i>{% trans "Mark as Solved" %}
{% else %}
<a class="btn btn-warning" role="button">
<i class="fa fa-cross"></i>{% trans "Mark as Not Solved" %}
{% endif %}
</a>
<form class="form" method="post">
{% csrf_token %}
{% bootstrap_form changestatusform %}
{% if not ticket.solved %}
{% bootstrap_button "Résoudre" button_type="submit" button_class='btn-info' %}
{% else %}
{% bootstrap_button "Ouvrir" button_type="submit" button_class='btn-warning' %}
{% endif %}
</form>
</div>
</div>
</div>

View file

@ -12,6 +12,7 @@ from .models import(
from .forms import (
NewTicketForm,
ChangeStatusTicketForm,
EditPreferencesForm,
)
@ -47,7 +48,11 @@ def new_ticket(request):
def aff_ticket(request,ticketid):
"""Vue d'affichage d'un ticket"""
ticket = Ticket.objects.filter(id=ticketid).get()
return render(request,'tickets/aff_ticket.html',{'ticket':ticket})
changestatusform = ChangeStatusTicketForm(request.POST)
if request.method == 'POST':
ticket.solved = not ticket.solved
ticket.save()
return render(request,'tickets/aff_ticket.html',{'ticket':ticket,'changestatusform':changestatusform})
def aff_tickets(request):
""" Vue d'affichage de tout les tickets """