Add appropriate permissions for subhire

This commit is contained in:
2022-12-16 14:25:55 +00:00
parent 311c02d554
commit 8393e85b74
4 changed files with 28 additions and 4 deletions

View File

@@ -0,0 +1,17 @@
# Generated by Django 3.2.16 on 2022-12-16 14:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0046_subhire'),
]
operations = [
migrations.AlterModelOptions(
name='subhire',
options={'permissions': [('subhire_finance', 'Can see financial data for subhire - insurance values')]},
),
]

View File

@@ -642,6 +642,11 @@ class Subhire(BaseEvent):
def earliest_time(self):
return find_earliest_event_time(self, [])
class Meta:
permissions = [
('subhire_finance', 'Can see financial data for subhire - insurance values')
]
class InvoiceManager(models.Manager):
def outstanding_invoices(self):

View File

@@ -40,15 +40,17 @@
<dl class="row">
<dt class="col-sm-6">Description</dt>
<dd class="col-sm-6">{{ object.description }}</dd>
{% if perms.RIGS.subhire_finance %}
<dt class="col-sm-6">Insurance Value</dt>
<dd class="col-sm-6">£{{ object.insurance_value }}</dd>
{% endif %}
</dl>
</div>
</div>
</div>
<div class="col-md-12 mt-2">
<div class="card card-default">
<div class="card-header">Associated Events</div>
<div class="card-header">Associated Event(s)</div>
{% with object.events.all as events %}
{% include 'partials/event_table.html' %}
{%endwith%}

View File

@@ -68,13 +68,13 @@ urlpatterns = [
# Subhire
path('subhire/<int:pk>/', views.SubhireDetail.as_view(),
path('subhire/<int:pk>/', login_required(views.SubhireDetail.as_view()),
name='subhire_detail'),
path('subhire/create/', permission_required_with_403('RIGS.add_event')(views.SubhireCreate.as_view()),
name='subhire_create'),
path('subhire/<int:pk>/edit', views.SubhireEdit.as_view(),
path('subhire/<int:pk>/edit', permission_required_with_403('RIGS.change_event')(views.SubhireEdit.as_view()),
name='subhire_update'),
path('subhire/upcoming', views.SubhireList.as_view(),
path('subhire/upcoming', login_required(views.SubhireList.as_view()),
name='subhire_list'),
# Dashboards