mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-21 15:32:14 +00:00
Add appropriate permissions for subhire
This commit is contained in:
17
RIGS/migrations/0047_alter_subhire_options.py
Normal file
17
RIGS/migrations/0047_alter_subhire_options.py
Normal 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')]},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -642,6 +642,11 @@ class Subhire(BaseEvent):
|
|||||||
def earliest_time(self):
|
def earliest_time(self):
|
||||||
return find_earliest_event_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):
|
class InvoiceManager(models.Manager):
|
||||||
def outstanding_invoices(self):
|
def outstanding_invoices(self):
|
||||||
|
|||||||
@@ -40,15 +40,17 @@
|
|||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-sm-6">Description</dt>
|
<dt class="col-sm-6">Description</dt>
|
||||||
<dd class="col-sm-6">{{ object.description }}</dd>
|
<dd class="col-sm-6">{{ object.description }}</dd>
|
||||||
|
{% if perms.RIGS.subhire_finance %}
|
||||||
<dt class="col-sm-6">Insurance Value</dt>
|
<dt class="col-sm-6">Insurance Value</dt>
|
||||||
<dd class="col-sm-6">£{{ object.insurance_value }}</dd>
|
<dd class="col-sm-6">£{{ object.insurance_value }}</dd>
|
||||||
|
{% endif %}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-2">
|
<div class="col-md-12 mt-2">
|
||||||
<div class="card card-default">
|
<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 %}
|
{% with object.events.all as events %}
|
||||||
{% include 'partials/event_table.html' %}
|
{% include 'partials/event_table.html' %}
|
||||||
{%endwith%}
|
{%endwith%}
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ urlpatterns = [
|
|||||||
|
|
||||||
|
|
||||||
# Subhire
|
# Subhire
|
||||||
path('subhire/<int:pk>/', views.SubhireDetail.as_view(),
|
path('subhire/<int:pk>/', login_required(views.SubhireDetail.as_view()),
|
||||||
name='subhire_detail'),
|
name='subhire_detail'),
|
||||||
path('subhire/create/', permission_required_with_403('RIGS.add_event')(views.SubhireCreate.as_view()),
|
path('subhire/create/', permission_required_with_403('RIGS.add_event')(views.SubhireCreate.as_view()),
|
||||||
name='subhire_create'),
|
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'),
|
name='subhire_update'),
|
||||||
path('subhire/upcoming', views.SubhireList.as_view(),
|
path('subhire/upcoming', login_required(views.SubhireList.as_view()),
|
||||||
name='subhire_list'),
|
name='subhire_list'),
|
||||||
|
|
||||||
# Dashboards
|
# Dashboards
|
||||||
|
|||||||
Reference in New Issue
Block a user