Add full event log to toolDetail

This commit is contained in:
Adam Goldsmith 2021-05-24 23:12:24 -04:00
parent eb0e58c9f4
commit 32609b000d
2 changed files with 28 additions and 0 deletions

View File

@ -1,5 +1,7 @@
{% extends "base.djhtml" %}
{% load markdownify %}
{% block title %} {{ tool }} | {{ block.super }} {% endblock %}
{% block admin_link %}{% url 'admin:tasks_tool_change' tool.id %}{% endblock %}
@ -20,4 +22,28 @@
{% endfor %}
</ul>
</section>
<section>
<h2>Event Log</h2>
<table class="table table-striped table-hover">
<thead>
<tr>
<th> Date </th>
<th> Task </th>
<th> User </th>
<th> Notes </th>
</tr>
</thead>
<tbody>
{% for event in events|dictsortreversed:"date" %}
<tr>
<td class="text-nowrap"> {{ event.date }} </td>
<td> {{ event.task.name }} </td>
<td> {{ event.user }} </td>
<td> {{ event.notes|markdownify }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endblock %}

View File

@ -16,9 +16,11 @@ def index(request):
def toolDetail(request, tool_slug):
tool = get_object_or_404(Tool, slug=tool_slug)
tasks = tool.task_set.all()
events = Event.objects.filter(task__tool=tool)
context = {
'tool': tool,
'tasks': tasks,
'events': events,
}
return render(request, 'tasks/toolDetail.djhtml', context)