From 3017896477a5ece8462c3636ddb97afbe376093f Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Thu, 29 Nov 2018 16:22:55 +0100 Subject: [PATCH] Show assigned users --- todosrht/templates/ticket.html | 9 +++++++++ todosrht/types/ticket.py | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/todosrht/templates/ticket.html b/todosrht/templates/ticket.html index ab17d73..adfc44d 100644 --- a/todosrht/templates/ticket.html +++ b/todosrht/templates/ticket.html @@ -104,6 +104,15 @@ {{ ticket.submitter }} +
Assigned to
+
+ {% for user in ticket.assigned_users %} + {{ user }} +
+ {% else %} + No-one. + {% endfor %} +
Submitted
{{ ticket.created | date }}
Updated
diff --git a/todosrht/types/ticket.py b/todosrht/types/ticket.py index 464d8d2..009e5e7 100644 --- a/todosrht/types/ticket.py +++ b/todosrht/types/ticket.py @@ -51,3 +51,7 @@ class Ticket(Base): view_list = sa.orm.relationship("TicketSeen") labels = sa.orm.relationship("Label", secondary="ticket_label") + + assigned_users = sa.orm.relationship("User", + secondary="ticket_assignee", + foreign_keys="[TicketAssignee.ticket_id,TicketAssignee.assignee_id]")