Add changes listing on item page

d42/ebin
informatic 2017-10-24 20:59:58 +02:00
parent 644765ec5f
commit be8a95685e
2 changed files with 16 additions and 0 deletions

View File

@ -89,6 +89,20 @@
</form>
{% endfor %}
{% endif %}
{% if history %}
<h3>Changes</h3>
<table class="table table-striped table-hover">
{% for entry in history %}
<tr>
<td class="{% if entry.is_addition %}text-success{% endif %}">
<b>{{ entry.user }}</b>
<small>@ {{ entry.action_time }}</small><br />
{{ entry.get_change_message }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
<div class="col-md-8">

View File

@ -3,6 +3,7 @@ from storage.models import Item, Label
from django.contrib.postgres.search import SearchVector
from django_select2.views import AutoResponseView
from django.http import Http404, JsonResponse
from django.contrib.admin.models import LogEntry
import shlex
def apply_smart_search(query, objects):
@ -65,6 +66,7 @@ def item_display(request, pk):
'categories': item.categories.all(),
'images': item.images.all(),
'labels': item.labels.all(),
'history': LogEntry.objects.filter(object_id=item.pk),
'ancestors': item.get_ancestors(),
'children': item.get_children().prefetch_related('categories'),
})