8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 20:03:11 +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: class Meta:
model = Preferences model = Preferences
fields = '__all__' 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> <p><b>{% trans "Description" %}</b> {{ ticket.description }}</p>
<div class="text-right"> <div class="text-right">
{% if not ticket.solved %} <form class="form" method="post">
<a class="btn btn-success" role="button"> {% csrf_token %}
<i class="fa fa-check"></i>{% trans "Mark as Solved" %} {% bootstrap_form changestatusform %}
{% else %}
<a class="btn btn-warning" role="button"> {% if not ticket.solved %}
<i class="fa fa-cross"></i>{% trans "Mark as Not Solved" %} {% bootstrap_button "Résoudre" button_type="submit" button_class='btn-info' %}
{% endif %} {% else %}
</a> {% bootstrap_button "Ouvrir" button_type="submit" button_class='btn-warning' %}
{% endif %}
</form>
</div> </div>
</div> </div>
</div> </div>

View file

@ -12,6 +12,7 @@ from .models import(
from .forms import ( from .forms import (
NewTicketForm, NewTicketForm,
ChangeStatusTicketForm,
EditPreferencesForm, EditPreferencesForm,
) )
@ -47,7 +48,11 @@ def new_ticket(request):
def aff_ticket(request,ticketid): def aff_ticket(request,ticketid):
"""Vue d'affichage d'un ticket""" """Vue d'affichage d'un ticket"""
ticket = Ticket.objects.filter(id=ticketid).get() 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): def aff_tickets(request):
""" Vue d'affichage de tout les tickets """ """ Vue d'affichage de tout les tickets """