diff --git a/RIGS/views.py b/RIGS/views.py index f90cd139..f521f47b 100644 --- a/RIGS/views.py +++ b/RIGS/views.py @@ -46,6 +46,7 @@ class PersonDetail(GenericDetailView): context['update_link'] = 'person_update' context['associated'] = 'partials/associated_organisations.html' context['associated2'] = 'partials/associated_events.html' + context['can_edit'] = self.request.user.has_perm('RIGS.change_person') return context @@ -88,6 +89,7 @@ class OrganisationDetail(GenericDetailView): context['update_link'] = 'organisation_update' context['associated'] = 'partials/associated_people.html' context['associated2'] = 'partials/associated_events.html' + context['can_edit'] = self.request.user.has_perm('RIGS.change_organisation') return context @@ -128,6 +130,7 @@ class VenueDetail(GenericDetailView): context['detail_link'] = 'venue_detail' context['update_link'] = 'venue_update' context['associated2'] = 'partials/associated_events.html' + context['can_edit'] = self.request.user.has_perm('RIGS.change_venue') return context diff --git a/assets/views.py b/assets/views.py index da120bf5..ccc26fa6 100644 --- a/assets/views.py +++ b/assets/views.py @@ -252,6 +252,7 @@ class SupplierDetail(GenericDetailView): context['override'] = "base_ajax.html" else: context['override'] = 'base_assets.html' + context['can_edit'] = self.request.user.has_perm('assets.change_supplier') return context diff --git a/templates/generic_detail.html b/templates/generic_detail.html index b4f927bd..6e6255a6 100644 --- a/templates/generic_detail.html +++ b/templates/generic_detail.html @@ -48,9 +48,11 @@ {% if not request.is_ajax %}
+ {% if can_edit %}
{% button 'edit' update_link object.pk %}
+ {% endif %} {% include 'partials/last_edited.html' with target=history_link %}
@@ -63,7 +65,9 @@
Open Page + {% if can_edit %} {% button 'edit' update_link object.pk %} + {% endif %}
{% include 'partials/last_edited.html' with target=history_link %}