tangled
alpha
login
or
join now
aottr.dev
/
paw
0
fork
atom
Free and open source ticket system written in python
0
fork
atom
overview
issues
pulls
pipelines
๐ IMPROVE: Update History view
Dustin Kroeger
2 years ago
dccae51a
1a59843e
+52
-30
3 changed files
expand all
collapse all
unified
split
paw
__init__.py
templates
ticketing
tickets_history.html
ticketing
views.py
+1
-1
paw/__init__.py
···
1
1
from django import get_version
2
2
3
3
-
VERSION = (0, 5, 4, "final", 0)
3
3
+
VERSION = (0, 5, 5, "final", 0)
4
4
5
5
__version__ = get_version(VERSION)
+50
-22
paw/templates/ticketing/tickets_history.html
···
1
1
{% extends 'dashboard_base.html' %}
2
2
{% block dashboard_content %}
3
3
-
<div class="w-full p-8">
4
4
-
<table class="table w-full">
5
5
-
<thead>
6
6
-
<tr>
7
7
-
<th></th>
8
8
-
<th>Title</th>
9
9
-
<th>Category</th>
10
10
-
<th></th>
11
11
-
</tr>
12
12
-
</thead>
13
13
-
<tbody>
14
14
-
{% for ticket in tickets %}
15
15
-
<tr>
16
16
-
<td>#{{ ticket.id }}</td>
17
17
-
<td>{{ ticket.title }}</td>
18
18
-
<td><div class="badge badge-neutral">{{ ticket.category }}</div></td>
19
19
-
<td class="flex justify-end"><a href="{% url 'ticket_detail' ticket.id %}" class="btn btn-xs btn-accent">View</a></td>
20
20
-
</tr>
21
21
-
{% endfor %}
22
22
-
</tbody>
23
23
-
</table>
24
24
-
</div>
3
3
+
{% load i18n %}
4
4
+
<div class="w-full p-8">
5
5
+
<h1 class="flex items-center text-2xl text-base-content font-bold mb-4">{% trans 'History' %}
6
6
+
{% if request.user.team_set.all %}
7
7
+
{% trans 'for' %}:
8
8
+
{% for team in request.user.team_set.all %}
9
9
+
<span class="ml-2 badge badge-neutral">{{ team.name }}</span>
10
10
+
{% endfor %}
11
11
+
{% endif %}
12
12
+
</h1>
13
13
+
<table class="table w-full">
14
14
+
<thead>
15
15
+
<tr>
16
16
+
<th></th>
17
17
+
<th>{% trans 'Title' %}</th>
18
18
+
<th>{% trans 'Assigned to' %}</th>
19
19
+
<th>{% trans 'Category' %}</th>
20
20
+
<th>{% trans 'Closed on' %}</th>
21
21
+
<th></th>
22
22
+
</tr>
23
23
+
</thead>
24
24
+
<tbody>
25
25
+
{% if tickets.count == 0 %}
26
26
+
<tr>
27
27
+
<td colspan="5" class="text-center p-10">{% trans 'No tickets found' %}</td>
28
28
+
</tr>
29
29
+
{% endif %}
30
30
+
{% for ticket in tickets %}
31
31
+
<tr>
32
32
+
<td><span class="badge badge-neutral">#{{ ticket.id }}</span></td>
33
33
+
<td>{{ ticket.title }}</td>
34
34
+
<td>
35
35
+
{% include 'partials/assigned_to.html' with assigned_to=ticket.assigned_to %}
36
36
+
</td>
37
37
+
<td>
38
38
+
<div class="badge badge-neutral">
39
39
+
{% if ticket.category %}
40
40
+
{{ ticket.category }}
41
41
+
{% else %}
42
42
+
{% trans 'General' %}
43
43
+
{% endif %}
44
44
+
</div>
45
45
+
</td>
46
46
+
<td>{{ ticket.updated_at|date:"d.m.Y H:m" }}</td>
47
47
+
<td class="flex justify-end"><a href="{% url 'ticket_detail' ticket.id %}" class="btn btn-xs btn-accent">{% trans 'View' %}</a></td>
48
48
+
</tr>
49
49
+
{% endfor %}
50
50
+
</tbody>
51
51
+
</table>
52
52
+
</div>
25
53
{% endblock %}
+1
-7
ticketing/views.py
···
14
14
15
15
@login_required
16
16
def show_tickets_history(request):
17
17
-
if request.user.is_staff:
18
18
-
tickets = Ticket.objects.filter(
19
19
-
status=Ticket.Status.CLOSED).order_by("priority", "-created_at")
20
20
-
print(tickets)
21
21
-
else:
22
22
-
tickets = Ticket.objects.filter(
23
23
-
user=request.user).order_by("-created_at")
17
17
+
tickets = Ticket.get_closed_tickets(request.user).order_by("priority", "-updated_at")
24
18
return render(request, "ticketing/tickets_history.html", {"tickets": tickets})
25
19
26
20