mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Generic list only displays edit button if user has perm
This commit is contained in:
@@ -31,6 +31,7 @@ class PersonList(GenericListView):
|
|||||||
context['page_title'] = "People"
|
context['page_title'] = "People"
|
||||||
context['create'] = 'person_create'
|
context['create'] = 'person_create'
|
||||||
context['edit'] = 'person_update'
|
context['edit'] = 'person_update'
|
||||||
|
context['can_edit'] = self.request.user.has_perm('RIGS.change_person')
|
||||||
context['detail'] = 'person_detail'
|
context['detail'] = 'person_detail'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ class OrganisationList(GenericListView):
|
|||||||
context = super(OrganisationList, self).get_context_data(**kwargs)
|
context = super(OrganisationList, self).get_context_data(**kwargs)
|
||||||
context['create'] = 'organisation_create'
|
context['create'] = 'organisation_create'
|
||||||
context['edit'] = 'organisation_update'
|
context['edit'] = 'organisation_update'
|
||||||
|
context['can_edit'] = self.request.user.has_perm('RIGS.change_organisation')
|
||||||
context['detail'] = 'organisation_detail'
|
context['detail'] = 'organisation_detail'
|
||||||
context['union_account'] = True
|
context['union_account'] = True
|
||||||
return context
|
return context
|
||||||
@@ -112,6 +114,7 @@ class VenueList(GenericListView):
|
|||||||
context = super(VenueList, self).get_context_data(**kwargs)
|
context = super(VenueList, self).get_context_data(**kwargs)
|
||||||
context['create'] = 'venue_create'
|
context['create'] = 'venue_create'
|
||||||
context['edit'] = 'venue_update'
|
context['edit'] = 'venue_update'
|
||||||
|
context['can_edit'] = self.request.user.has_perm('RIGS.change_venue')
|
||||||
context['detail'] = 'venue_detail'
|
context['detail'] = 'venue_detail'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ class SupplierList(GenericListView):
|
|||||||
context = super(SupplierList, self).get_context_data(**kwargs)
|
context = super(SupplierList, self).get_context_data(**kwargs)
|
||||||
context['create'] = 'supplier_create'
|
context['create'] = 'supplier_create'
|
||||||
context['edit'] = 'supplier_update'
|
context['edit'] = 'supplier_update'
|
||||||
|
context['can_edit'] = self.request.user.has_perm('assets.change_supplier')
|
||||||
context['detail'] = 'supplier_detail'
|
context['detail'] = 'supplier_detail'
|
||||||
if self.request.is_ajax():
|
if self.request.is_ajax():
|
||||||
context['override'] = "base_ajax.html"
|
context['override'] = "base_ajax.html"
|
||||||
|
|||||||
@@ -41,7 +41,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="btn-group d-flex" role="group">
|
<div class="btn-group d-flex" role="group">
|
||||||
{% button 'view' url=detail pk=object.pk clazz="btn-sm modal-href" %}
|
{% button 'view' url=detail pk=object.pk clazz="btn-sm modal-href" %}
|
||||||
|
{% if can_edit %}
|
||||||
{% button 'edit' url=edit pk=object.pk clazz="btn-sm modal-href" %}
|
{% button 'edit' url=edit pk=object.pk clazz="btn-sm modal-href" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user