Add changes listing on item page
This commit is contained in:
parent
644765ec5f
commit
be8a95685e
|
@ -89,6 +89,20 @@
|
||||||
</form>
|
</form>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% 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>
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
|
@ -3,6 +3,7 @@ from storage.models import Item, Label
|
||||||
from django.contrib.postgres.search import SearchVector
|
from django.contrib.postgres.search import SearchVector
|
||||||
from django_select2.views import AutoResponseView
|
from django_select2.views import AutoResponseView
|
||||||
from django.http import Http404, JsonResponse
|
from django.http import Http404, JsonResponse
|
||||||
|
from django.contrib.admin.models import LogEntry
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
def apply_smart_search(query, objects):
|
def apply_smart_search(query, objects):
|
||||||
|
@ -65,6 +66,7 @@ def item_display(request, pk):
|
||||||
'categories': item.categories.all(),
|
'categories': item.categories.all(),
|
||||||
'images': item.images.all(),
|
'images': item.images.all(),
|
||||||
'labels': item.labels.all(),
|
'labels': item.labels.all(),
|
||||||
|
'history': LogEntry.objects.filter(object_id=item.pk),
|
||||||
'ancestors': item.get_ancestors(),
|
'ancestors': item.get_ancestors(),
|
||||||
'children': item.get_children().prefetch_related('categories'),
|
'children': item.get_children().prefetch_related('categories'),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue