mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-16 21:12:13 +00:00
Add space for power/rigging plans to be linked to RAs
This commit is contained in:
34
RIGS/migrations/0046_auto_20201213_1625.py
Normal file
34
RIGS/migrations/0046_auto_20201213_1625.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 3.1.2 on 2020-12-13 16:25
|
||||
|
||||
import RIGS.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0045_auto_20201116_1808'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='riskassessment',
|
||||
name='power_plan',
|
||||
field=models.URLField(blank=True, help_text="Upload your power plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", null=True, validators=[RIGS.models.validate_url]),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='riskassessment',
|
||||
name='rigging_plan',
|
||||
field=models.URLField(blank=True, help_text="Upload your rigging plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", null=True, validators=[RIGS.models.validate_url]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='riskassessment',
|
||||
name='contractors',
|
||||
field=models.BooleanField(help_text='Are you using any external contractors?<br><small>i.e. Freelancers/Crewing Companies</small>'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='riskassessment',
|
||||
name='other_companies',
|
||||
field=models.BooleanField(help_text='Are TEC working with any other companies on site?<br><small>e.g. TEC is providing the lighting while another company does sound</small>'),
|
||||
),
|
||||
]
|
||||
@@ -19,6 +19,8 @@ from decimal import Decimal
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
class Profile(AbstractUser):
|
||||
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
||||
@@ -610,6 +612,14 @@ class Payment(models.Model, RevisionMixin):
|
||||
return str("payment at £{}".format(self.amount))
|
||||
|
||||
|
||||
def validate_url(value):
|
||||
if not value:
|
||||
return # Required error is done the field
|
||||
obj = urlparse(value)
|
||||
if not obj.hostname in ('nottinghamtec.sharepoint.com'):
|
||||
raise ValidationError('URL must point to a location on the TEC Sharepoint')
|
||||
|
||||
|
||||
@reversion.register
|
||||
class RiskAssessment(models.Model, RevisionMixin):
|
||||
event = models.OneToOneField('Event', on_delete=models.CASCADE)
|
||||
@@ -617,8 +627,8 @@ class RiskAssessment(models.Model, RevisionMixin):
|
||||
nonstandard_equipment = models.BooleanField(help_text="Does the event require any hired in equipment or use of equipment that is not covered by <a href='https://nottinghamtec.sharepoint.com/:f:/g/HealthAndSafety/Eo4xED_DrqFFsfYIjKzMZIIB6Gm_ZfR-a8l84RnzxtBjrA?e=Bf0Haw'>"
|
||||
"TEC's standard risk assessments and method statements?</a>")
|
||||
nonstandard_use = models.BooleanField(help_text="Are TEC using their equipment in a way that is abnormal?<br><small>i.e. Not covered by TECs standard health and safety documentation</small>")
|
||||
contractors = models.BooleanField(help_text="Are you using any external contractors?<small>i.e. Freelancers/Crewing Companies</small>")
|
||||
other_companies = models.BooleanField(help_text="Are TEC working with any other companies on site?<small>e.g. TEC is providing the lighting while another company does sound</small>")
|
||||
contractors = models.BooleanField(help_text="Are you using any external contractors?<br><small>i.e. Freelancers/Crewing Companies</small>")
|
||||
other_companies = models.BooleanField(help_text="Are TEC working with any other companies on site?<br><small>e.g. TEC is providing the lighting while another company does sound</small>")
|
||||
crew_fatigue = models.BooleanField(help_text="Is crew fatigue likely to be a risk at any point during this event?")
|
||||
general_notes = models.TextField(blank=True, null=True, help_text="Did you have to consult a supervisor about any of the above? If so who did you consult and what was the outcome?")
|
||||
|
||||
@@ -633,6 +643,7 @@ class RiskAssessment(models.Model, RevisionMixin):
|
||||
nonstandard_equipment_power = models.BooleanField(help_text="Does the power plan require the use of any power equipment (distros, dimmers, motor controllers, etc.) that does not belong to TEC?")
|
||||
multiple_electrical_environments = models.BooleanField(help_text="Will the electrical installation occupy more than one electrical environment?")
|
||||
power_notes = models.TextField(blank=True, null=True, help_text="Did you have to consult a supervisor about any of the above? If so who did you consult and what was the outcome?")
|
||||
power_plan = models.URLField(blank=True, null=True, help_text="Upload your power plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", validators=[validate_url])
|
||||
|
||||
# Sound
|
||||
noise_monitoring = models.BooleanField(help_text="Does the event require noise monitoring or any non-standard procedures in order to comply with health and safety legislation or site rules?")
|
||||
@@ -650,6 +661,7 @@ class RiskAssessment(models.Model, RevisionMixin):
|
||||
special_structures = models.BooleanField(help_text="Does the event require use of winch stands, motors, MPT Towers, or staging?")
|
||||
suspended_structures = models.BooleanField(help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?")
|
||||
persons_responsible_structures = models.TextField(blank=True, null=True, help_text="Who are the persons on site responsible for their use?")
|
||||
rigging_plan = models.URLField(blank=True, null=True, help_text="Upload your rigging plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", validators=[validate_url])
|
||||
|
||||
# Blimey that was a lot of options
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% block title %}Risk Assessment for Event N{{ object.event.pk|stringformat:"05d" }} {{ object.event.name }}{% endblock %}
|
||||
{% load help_text from filters %}
|
||||
{% load yesnoi from filters %}
|
||||
{% load linkornone from filters %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row py-3">
|
||||
@@ -11,7 +12,7 @@
|
||||
<div class="card-header">General</div>
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-10">{{ object|help_text:'nonstandard_equipment' }}</dt>
|
||||
<dt class="col-10">{{ object|help_text:'nonstandard_equipment'|safe }}</dt>
|
||||
<dd class="col-2">
|
||||
{{ object.nonstandard_equipment|yesnoi:'invert' }}
|
||||
</dd>
|
||||
@@ -19,11 +20,11 @@
|
||||
<dd class="col-2">
|
||||
{{ object.nonstandard_use|yesnoi:'invert' }}
|
||||
</dd>
|
||||
<dt class="col-10">{{ object|help_text:'contractors' }}</dt>
|
||||
<dt class="col-10">{{ object|help_text:'contractors'|safe }}</dt>
|
||||
<dd class="col-2">
|
||||
{{ object.contractors|yesnoi:'invert' }}
|
||||
</dd>
|
||||
<dt class="col-10">{{ object|help_text:'other_companies' }}</dt>
|
||||
<dt class="col-10">{{ object|help_text:'other_companies'|safe }}</dt>
|
||||
<dd class="col-2">
|
||||
{{ object.other_companies|yesnoi:'invert' }}
|
||||
</dd>
|
||||
@@ -74,6 +75,10 @@
|
||||
<dd class="col-12">
|
||||
{{ object.power_notes|default:'N/A'|linebreaks }}
|
||||
</dd>
|
||||
<dt class="col-6">{{ object|help_text:'power_plan'|safe }}</dt>
|
||||
<dd class="col-6">
|
||||
{{ object.power_plan|linkornone }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -139,6 +144,10 @@
|
||||
<dd class="col-sm-6">
|
||||
{{ object.persons_responsible_structures.name|default:'N/A'|linebreaks }}
|
||||
</dd>
|
||||
<dt class="col-6">{{ object|help_text:'rigging_plan'|safe }}</dt>
|
||||
<dd class="col-6">
|
||||
{{ object.rigging_plan|linkornone }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,6 +100,8 @@
|
||||
{% include 'partials/yes_no_radio.html' with formitem=form.multiple_electrical_environments %}
|
||||
<label for="{{ form.power_notes.id_for_label }}">{{ form.power_notes.help_text }}</label>
|
||||
{% render_field form.power_notes class+="form-control" %}
|
||||
<label for="{{ form.power_plan.id_for_label }}" class="mt-2">{{ form.power_plan.help_text|safe }}</label>
|
||||
{% render_field form.power_plan class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,6 +144,8 @@
|
||||
{% include 'partials/yes_no_radio.html' with formitem=form.suspended_structures %}
|
||||
<label for="{{ form.persons_responsible_structures.id_for_label }}" class="mt-3">{{ form.persons_responsible_structures.help_text }}</label>
|
||||
{% render_field form.persons_responsible_structures class+="form-control mb-3" %}
|
||||
<label for="{{ form.rigging_plan.id_for_label }}" class="mt-2">{{ form.rigging_plan.help_text|safe }}</label>
|
||||
{% render_field form.rigging_plan class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -179,9 +179,11 @@ def namewithnotes(obj, url, autoescape=True):
|
||||
|
||||
|
||||
@register.filter(needs_autoescape=True)
|
||||
def linkornone(attr, namespace, autoescape=True):
|
||||
def linkornone(attr, namespace=None, autoescape=True):
|
||||
if attr is not None:
|
||||
return mark_safe("<a href='{}://{}' target='_blank'><span class='overflow-ellipsis'>{}</span></a>".format(namespace, attr, str(attr)))
|
||||
if namespace is not None:
|
||||
attr = namespace + "://" + attr
|
||||
return mark_safe("<a href='{}' target='_blank'><span class='overflow-ellipsis'>{}</span></a>".format(attr, str(attr)))
|
||||
else:
|
||||
return "None"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user