Browse Source

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

Sebastian Lohff 2 years ago
parent
commit
098c45e241
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      templates/whoisdb/handle_panel.html

+ 4
- 0
templates/whoisdb/handle_panel.html View File

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

Loading…
Cancel
Save