Only show delete/edit buttons in header if user is allowed to edit the object

This commit is contained in:
Sebastian Lohff 2017-04-15 20:50:05 +02:00
parent 619ee3bc58
commit 098c45e241
1 changed files with 4 additions and 0 deletions

View File

@ -1,13 +1,17 @@
{% load handletags %}
{% with object.getAppName|add:":"|add:object.getClassName|lower|add:"-edit" as editView %}
{% with object.getAppName|add:":"|add:object.getClassName|lower|add:"-delete" as deleteView %}
<div class="panel panel-default">
<div class="panel-heading">
{{ object }} <small>({{ object.getClassName }})</small>
{% if object|userCanEdit:request.user %}
<span class="pull-right">
<a href="{% url editView object.getPK %}"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{% url deleteView object.getPK %}"><span class="glyphicon glyphicon-trash"></span></a>
</span>
{% endif %}
</div>
<div class="panel-body">
{% include "whoisdb/handle_table.html" with object=object %}