From 13afc5aaebf32a5160bf6a9aea21c9b38908de8d Mon Sep 17 00:00:00 2001 From: Grizzly Date: Thu, 11 Jul 2019 08:27:58 +0000 Subject: [PATCH] Dummy bouton, order des date, et affichage dans l'admin --- tickets/models.py | 3 +++ tickets/templates/tickets/aff_ticket.html | 10 ++++++++++ tickets/views.py | 2 +- users/views.py | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tickets/models.py b/tickets/models.py index abdab335..ba0b183e 100644 --- a/tickets/models.py +++ b/tickets/models.py @@ -33,3 +33,6 @@ class Ticket(models.Model): class Meta: verbose_name = _("Ticket") verbose_name_plural = _("Tickets") + + def __str__(self): + return "Ticket de {} date: {}".format(self.user.surname,self.date) diff --git a/tickets/templates/tickets/aff_ticket.html b/tickets/templates/tickets/aff_ticket.html index 242aa4f4..42ef897b 100644 --- a/tickets/templates/tickets/aff_ticket.html +++ b/tickets/templates/tickets/aff_ticket.html @@ -46,6 +46,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,

{% trans "Title:" %} {{ticket.title}}

{% trans "Description" %} {{ ticket.description }}

+
+{% if not ticket.solved %} + + {% trans "Mark as Solved" %} +{% else %} + + {% trans "Mark as Not Solved" %} +{% endif %} + +
diff --git a/tickets/views.py b/tickets/views.py index c6eccdd7..270bf0df 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -38,6 +38,6 @@ def aff_ticket(request,ticketid): def aff_tickets(request): """ Vue d'affichage de tout les tickets """ - tickets = Ticket.objects.all().order_by('date') + tickets = Ticket.objects.all().order_by('-date') return render(request,'tickets/index.html', {'tickets_list':tickets}) diff --git a/users/views.py b/users/views.py index 4bed47f4..a039bad6 100644 --- a/users/views.py +++ b/users/views.py @@ -978,7 +978,7 @@ def profil(request, users, **_kwargs): request.GET.get('order'), SortTable.MACHINES_INDEX ) - tickets = Ticket.objects.filter(user=users).all().order_by('date') + tickets = Ticket.objects.filter(user=users).all().order_by('-date') nb_tickets = tickets.count() pagination_large_number = GeneralOption.get_cached_value( 'pagination_large_number'