From a0293a11b385e39ea673c1eb72e1401bfec0179d Mon Sep 17 00:00:00 2001 From: Grizzly Date: Wed, 10 Jul 2019 09:16:37 +0000 Subject: [PATCH] Affichage des tickets sur le profil --- tickets/templates/tickets/aff_tickets.html | 1 - users/templates/users/profil.html | 25 ++++++++++++++++++---- users/views.py | 8 +++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/tickets/templates/tickets/aff_tickets.html b/tickets/templates/tickets/aff_tickets.html index 04487425..54573ace 100644 --- a/tickets/templates/tickets/aff_tickets.html +++ b/tickets/templates/tickets/aff_tickets.html @@ -1,4 +1,3 @@ -{% extends 'users/sidebar.html' %} {% comment %} Re2o est un logiciel d'administration développé initiallement au rezometz. Il se veut agnostique au réseau considéré, de manière à être installable en diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 5b57f6a8..dee64ccc 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -120,10 +120,6 @@ with this program; if not, write to the Free Software Foundation, Inc., - - {% trans " Open a Ticket" %} - -
+
+
+

+ {% trans " Tickets" %} +

+
+
+ +
+ {% if tickets_list %} + {% include 'tickets/aff_tickets.html' with tickets_list=tickets_list %} + {% else %} +

{% trans "No tickets" %}

+ {% endif %} +
+
+
{% endblock %} diff --git a/users/views.py b/users/views.py index ad8543b5..ca95e584 100644 --- a/users/views.py +++ b/users/views.py @@ -53,6 +53,10 @@ from reversion import revisions as reversion from cotisations.models import Facture, Paiement from machines.models import Machine + +# A IMPORTER SOUS CONDITION QUE TICKET SOIT INSTALLED +from tickets.models import Ticket + from preferences.models import OptionalUser, GeneralOption, AssoOption from re2o.views import form from re2o.utils import ( @@ -974,6 +978,8 @@ def profil(request, users, **_kwargs): request.GET.get('order'), SortTable.MACHINES_INDEX ) + tickets = Ticket.objects.filter(user=users).all() + nb_tickets = tickets.count() pagination_large_number = GeneralOption.get_cached_value( 'pagination_large_number' ) @@ -1016,6 +1022,8 @@ def profil(request, users, **_kwargs): 'users': users, 'machines_list': machines, 'nb_machines': nb_machines, + 'tickets_list': tickets, + 'nb_tickets': nb_tickets, 'facture_list': factures, 'ban_list': bans, 'white_list': whitelists,