diff --git a/RIGS/migrations/0053_auto_20200830_1940.py b/RIGS/migrations/0053_auto_20200830_1940.py
new file mode 100644
index 00000000..558dd21f
--- /dev/null
+++ b/RIGS/migrations/0053_auto_20200830_1940.py
@@ -0,0 +1,83 @@
+# Generated by Django 3.1 on 2020-08-30 18:40
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('RIGS', '0052_auto_20200830_1117'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w1_description',
+ field=models.CharField(blank=True, help_text='Description', max_length=255, null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w1_earth_fault',
+ field=models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (ZS)', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w1_polarity',
+ field=models.BooleanField(blank=True, help_text='Polarity Checked?', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w1_voltage',
+ field=models.IntegerField(blank=True, help_text='Voltage', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w2_description',
+ field=models.CharField(blank=True, help_text='Description', max_length=255, null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w2_earth_fault',
+ field=models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (ZS)', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w2_polarity',
+ field=models.BooleanField(blank=True, help_text='Polarity Checked?', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w2_voltage',
+ field=models.IntegerField(blank=True, help_text='Voltage', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w3_description',
+ field=models.CharField(blank=True, help_text='Description', max_length=255, null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w3_earth_fault',
+ field=models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (ZS)', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w3_polarity',
+ field=models.BooleanField(blank=True, help_text='Polarity Checked?', null=True),
+ ),
+ migrations.AddField(
+ model_name='eventchecklist',
+ name='w3_voltage',
+ field=models.IntegerField(blank=True, help_text='Voltage', null=True),
+ ),
+ migrations.AlterField(
+ model_name='eventchecklist',
+ name='all_rcds_tested',
+ field=models.BooleanField(blank=True, help_text='All circuit RCDs tested?
(using test button)', null=True),
+ ),
+ migrations.AlterField(
+ model_name='eventchecklist',
+ name='public_sockets_tested',
+ field=models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?
(using socket tester)', null=True),
+ ),
+ ]
diff --git a/RIGS/models.py b/RIGS/models.py
index 3356a82d..af30365d 100644
--- a/RIGS/models.py
+++ b/RIGS/models.py
@@ -672,6 +672,19 @@ class EventChecklist(models.Model, RevisionMixin):
fd_phase_rotation = models.BooleanField(blank=True,null=True,verbose_name="Phase Rotation", help_text="Phase Rotation
(if required)")
fd_earth_fault = models.IntegerField(blank=True,null=True,verbose_name="Earth Fault Loop Impedance", help_text="Earth Fault Loop Impedance (ZS)")
fd_pssc = models.IntegerField(blank=True,null=True,verbose_name="PSCC", help_text="Prospective Short Circuit Current")
+ #Worst case points
+ w1_description = models.CharField(blank=True,null=True,max_length=255, help_text="Description")
+ w1_polarity = models.BooleanField(blank=True,null=True,help_text="Polarity Checked?")
+ w1_voltage = models.IntegerField(blank=True,null=True,help_text="Voltage")
+ w1_earth_fault = models.IntegerField(blank=True,null=True,help_text="Earth Fault Loop Impedance (ZS)")
+ w2_description = models.CharField(blank=True,null=True,max_length=255, help_text="Description")
+ w2_polarity = models.BooleanField(blank=True,null=True,help_text="Polarity Checked?")
+ w2_voltage = models.IntegerField(blank=True,null=True,help_text="Voltage")
+ w2_earth_fault = models.IntegerField(blank=True,null=True,help_text="Earth Fault Loop Impedance (ZS)")
+ w3_description = models.CharField(blank=True,null=True,max_length=255, help_text="Description")
+ w3_polarity = models.BooleanField(blank=True,null=True,help_text="Polarity Checked?")
+ w3_voltage = models.IntegerField(blank=True,null=True,help_text="Voltage")
+ w3_earth_fault = models.IntegerField(blank=True,null=True,help_text="Earth Fault Loop Impedance (ZS)")
all_rcds_tested = models.BooleanField(blank=True,null=True,help_text="All circuit RCDs tested?
(using test button)")
public_sockets_tested = models.BooleanField(blank=True,null=True,help_text="Public/Performer accessible circuits tested?
(using socket tester)")
@@ -679,11 +692,21 @@ class EventChecklist(models.Model, RevisionMixin):
def clean(self):
errdict = {}
if self.earthing == None or self.pat == None:
- raise ValidationError('Fill out the electrical checks')
- if self.medium_event and (self.source_rcd == None or self.labelling == None or self.all_rcds_tested == None or self.public_sockets_tested == None):
- raise ValidationError('Fill out the medium event electrical checks')
- elif self.rcds == None or self.supply_test == None:
- raise ValidationError('Fill out the small event electrical checks')
+ errdict['earthing'] = 'Fill out the electrical checks'
+
+ if not self.medium_event and (self.rcds == None or self.supply_test == None):
+ errdict['rcds'] = 'Fill out the small event electrical checks'
+
+ if self.medium_event:
+ if self.source_rcd == None or self.labelling == None or self.all_rcds_tested == None or self.public_sockets_tested == None:
+ errdict['source_rcd'] = 'Fill out the medium event electrical checks'
+
+ if self.w1_description == None or self.w1_polarity == None or self.w1_voltage == None or self.w1_earth_fault == None:
+ errdict['w1_description'] = 'Fully complete at least the first worst case point'
+
+ if errdict != {}: # If there was an error when validation
+ raise ValidationError(errdict)
+
@property
def activity_feed_string(self):
diff --git a/RIGS/templates/event_checklist_detail.html b/RIGS/templates/event_checklist_detail.html
index 3e0f0fec..28fe8063 100644
--- a/RIGS/templates/event_checklist_detail.html
+++ b/RIGS/templates/event_checklist_detail.html
@@ -2,6 +2,7 @@
{% block title %}Event Checklist for Event N{{ object.event.pk|stringformat:"05d" }} {{ object.event.name }}{% endblock %}
{% load help_text from filters %}
{% load profile_by_index from filters %}
+{% load yesnoi from filters %}
{% block content %}
@@ -40,27 +41,27 @@
- {{ object|help_text:'safe_parking'|safe }}
-
- {{ object.safe_parking|yesno|title }}
+ {{ object.safe_parking|yesnoi }}
- {{ object|help_text:'safe_packing'|safe }}
-
- {{ object.safe_packing|yesno|title }}
+ {{ object.safe_packing|yesnoi }}
- {{ object|help_text:'exits'|safe }}
-
- {{ object.exits|yesno|title }}
+ {{ object.exits|yesnoi }}
- {{ object|help_text:'trip_hazard'|safe }}
-
- {{ object.trip_hazard|yesno|title }}
+ {{ object.trip_hazard|yesnoi }}
- {{ object|help_text:'warning_signs'|safe }}
-
- {{ object.warning_signs|yesno|title }}
+ {{ object.warning_signs|yesnoi }}
- {{ object|help_text:'ear_plugs'|safe }}
-
- {{ object.ear_plugs|yesno|title }}
+ {{ object.ear_plugs|yesnoi }}
@@ -97,19 +98,19 @@
- {{ object|help_text:'source_rcd'|safe }}
-
- {{ object.source_rcd|yesno|title }}
+ {{ object.source_rcd|yesnoi }}
- {{ object|help_text:'labelling'|safe }}
-
- {{ object.labelling|yesno|title }}
+ {{ object.labelling|yesnoi }}
- {{ object|help_text:'earthing'|safe }}
-
- {{ object.earthing|yesno|title }}
+ {{ object.earthing|yesnoi }}
- {{ object|help_text:'pat'|safe }}
-
- {{ object.pat|yesno|title }}
+ {{ object.pat|yesnoi }}
@@ -135,7 +136,7 @@
| {{ object|help_text:'fd_phase_rotation'|safe }} |
- {{ object.fd_phase_rotation|yesno|title }} |
+ {{ object.fd_phase_rotation|yesnoi }} |
| {{ object|help_text:'fd_earth_fault'|safe}} |
@@ -148,34 +149,73 @@
+ Tests at 'Worst Case' points (at least 1 point required)
+
+
+
+ | Test |
+ Point 1 |
+ Point 2 |
+ Point 3 |
+
+
+
+
+ | {{ object|help_text:'w1_description'|safe}} |
+ {{ object.w1_description }} |
+ {{ object.w2_description|default:'' }} |
+ {{ object.w3_description|default:'' }} |
+
+
+ | {{ object|help_text:'w1_polarity'|safe}} |
+ {{ object.w1_polarity|yesnoi }} |
+ {{ object.w2_polarity|default:''|yesnoi }} |
+ {{ object.w3_polarity|default:''|yesnoi }} |
+
+
+ | {{ object|help_text:'w1_voltage'|safe}} |
+ {{ object.w1_voltage }} |
+ {{ object.w2_voltage|default:'' }} |
+ {{ object.w3_voltage|default:'' }} |
+
+
+ | {{ object|help_text:'w1_earth_fault'|safe}} |
+ {{ object.w1_earth_fault }} |
+ {{ object.w2_earth_fault|default:'' }} |
+ {{ object.w3_earth_fault|default:'' }} |
+
+
+
+
- {{ object|help_text:'all_rcds_tested'|safe }}
-
- {{ object.all_rcds_tested|yesno|title }}
+ {{ object.all_rcds_tested|yesnoi }}
- {{ object|help_text:'public_sockets_tested'|safe }}
-
- {{ object.public_sockets_tested|yesno|title }}
+ {{ object.public_sockets_tested|yesnoi }}
+
{% include 'partials/ec_power_info.html' %}
{% else %}
- {{ object|help_text:'rcds'|safe }}
-
- {{ object.rcds|yesno|title }}
+ {{ object.rcds|yesnoi }}
- {{ object|help_text:'supply_test'|safe }}
-
- {{ object.supply_test|yesno|title }}
+ {{ object.supply_test|yesnoi }}
- {{ object|help_text:'earthing'|safe }}
-
- {{ object.earthing|yesno|title }}
+ {{ object.earthing|yesnoi }}
- {{ object|help_text:'pat'|safe }}
-
- {{ object.pat|yesno|title }}
+ {{ object.pat|yesnoi }}
{% endif %}
diff --git a/RIGS/templates/event_checklist_form.html b/RIGS/templates/event_checklist_form.html
index d6be3c53..ae3827d5 100644
--- a/RIGS/templates/event_checklist_form.html
+++ b/RIGS/templates/event_checklist_form.html
@@ -79,7 +79,7 @@
$(".selectpicker").each(function(){initPicker($(this))});
$(target).attr('data-pk', newID - 1);
});
- $('button[data-action=delete]').on('click', function(event) {
+ $(document).on('click', 'button[data-action=delete]', function(event) {
event.preventDefault();
$(this).closest('tr').remove();
});
@@ -111,13 +111,13 @@
- Event Date
- - {{form.event.start_date}}
+ - {{ event.start_date}}{%if event.end_date %}-{{ event.end_date}}{%endif%}
- Event Name
- - {{form.event.name}}
+ - {{ event.name }}
- Client
- - {{form.event.person}}
+ - {{ event.person }}
- Venue
- - {{form.event.Venue}}
+ - {{ event.venue }}
@@ -143,7 +143,6 @@
|
|
- {# TODO Add required to all fields on row when one is edited #}
{% for i in object.vehicles.all %}
|
@@ -304,6 +303,44 @@
+ Tests at 'Worst Case' points (at least 1 point required)
+
+
+
+ | Test |
+ Point 1 |
+ Point 2 |
+ Point 3 |
+
+
+
+
+ | {{form.w1_description.help_text|safe}} |
+ {% render_field form.w1_description class+="form-control" %} |
+ {% render_field form.w2_description class+="form-control" %} |
+ {% render_field form.w3_description class+="form-control" %} |
+
+
+ | {{form.w1_polarity.help_text|safe}} |
+ {% render_field form.w1_polarity %} |
+ {% render_field form.w2_polarity %} |
+ {% render_field form.w3_polarity %} |
+
+
+ | {{form.w1_voltage.help_text|safe}} |
+ {% render_field form.w1_voltage class+="form-control" %} |
+ {% render_field form.w2_voltage class+="form-control" %} |
+ {% render_field form.w3_voltage class+="form-control" %} |
+
+
+ | {{form.w1_earth_fault.help_text|safe}} |
+ {% render_field form.w1_earth_fault class+="form-control" %} |
+ {% render_field form.w2_earth_fault class+="form-control" %} |
+ {% render_field form.w3_earth_fault class+="form-control" %} |
+
+
+
+
{% include 'partials/checklist_checkbox.html' with formitem=form.all_rcds_tested %}
{% include 'partials/checklist_checkbox.html' with formitem=form.public_sockets_tested %}
{% include 'partials/ec_power_info.html' %}
diff --git a/RIGS/templates/partials/ec_power_info.html b/RIGS/templates/partials/ec_power_info.html
index b60d567e..ff047b77 100644
--- a/RIGS/templates/partials/ec_power_info.html
+++ b/RIGS/templates/partials/ec_power_info.html
@@ -1,7 +1,7 @@
-Threshhold Values
+Threshhold Values
-
+
| RCD Value (mA) |
@@ -28,7 +28,7 @@
-
+
| Distro |
diff --git a/RIGS/templates/risk_assessment_detail.html b/RIGS/templates/risk_assessment_detail.html
index 6d521501..b79c086c 100644
--- a/RIGS/templates/risk_assessment_detail.html
+++ b/RIGS/templates/risk_assessment_detail.html
@@ -1,6 +1,7 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
{% 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 %}
{% block content %}
@@ -18,23 +19,23 @@
- {{ object|help_text:'nonstandard_equipment' }}
-
- {{ object.nonstandard_equipment|yesno|title }}
+ {{ object.nonstandard_equipment|yesnoi:'invert' }}
- {{ object|help_text:'nonstandard_use'|safe }}
-
- {{ object.nonstandard_use|yesno|title }}
+ {{ object.nonstandard_use|yesnoi:'invert' }}
- {{ object|help_text:'contractors' }}
-
- {{ object.contractors|yesno|title }}
+ {{ object.contractors|yesnoi:'invert' }}
- {{ object|help_text:'other_companies' }}
-
- {{ object.othercompanies|yesno|title }}
+ {{ object.othercompanies|yesnoi:'invert' }}
- {{ object|help_text:'crew_fatigue' }}
-
- {{ object.crewfatigue|yesno|title }}
+ {{ object.crewfatigue|yesnoi:'invert' }}
- {{ object|help_text:'general_notes' }}
-
@@ -49,7 +50,7 @@
- {{ object|help_text:'big_power' }}
-
- {{ object.big_power|yesno|title }}
+ {{ object.big_power|yesnoi:'invert' }}
- {{ object|help_text:'power_mic' }}
-
@@ -57,19 +58,19 @@
- {{ object|help_text:'generators' }}
-
- {{ object.generators|yesno|title }}
+ {{ object.generators|yesnoi:'invert' }}
- {{ object|help_text:'other_companies_power' }}
-
- {{ object.other_companies_power|yesno|title }}
+ {{ object.other_companies_power|yesnoi:'invert' }}
- {{ object|help_text:'nonstandard_equipment_power' }}
-
- {{ object.nonstandard_equipment_power|yesno|title }}
+ {{ object.nonstandard_equipment_power|yesnoi:'invert' }}
- {{ object|help_text:'multiple_electrical_environments' }}
-
- {{ object.multiple_electrical_environments|yesno|title }}
+ {{ object.multiple_electrical_environments|yesnoi:'invert' }}
- {{ object|help_text:'power_notes' }}
-
@@ -84,7 +85,7 @@
- {{ object|help_text:'noise_monitoring' }}
-
- {{ object.noise_monitoring|yesno|title }}
+ {{ object.noise_monitoring|yesnoi:'invert' }}
- {{ object|help_text:'sound_notes' }}
-
@@ -99,27 +100,27 @@
- {{ object|help_text:'known_venue' }}
-
- {{ object.known_venue|yesno|title }}
+ {{ object.known_venue|yesnoi }}
- {{ object|help_text:'safe_loading'|safe }}
-
- {{ object.safe_loading.name|yesno|title }}
+ {{ object.safe_loading.name|yesnoi }}
- {{ object|help_text:'safe_storage' }}
-
- {{ object.safe_storage|yesno|title }}
+ {{ object.safe_storage|yesnoi }}
- {{ object|help_text:'area_outside_of_control' }}
-
- {{ object.area_outside_of_control|yesno|title }}
+ {{ object.area_outside_of_control|yesnoi:'invert' }}
- {{ object|help_text:'barrier_required' }}
-
- {{ object.barrier_required|yesno|title }}
+ {{ object.barrier_required|yesnoi:'invert' }}
- {{ object|help_text:'nonstandard_emergency_procedure' }}
-
- {{ object.nonstandard_emergency_procedure|yesno|title }}
+ {{ object.nonstandard_emergency_procedure|yesnoi:'invert' }}
@@ -130,7 +131,7 @@
- {{ object|help_text:'special_structures' }}
-
- {{ object.special_structures|yesno|title }}
+ {{ object.special_structures|yesnoi:'invert' }}
- {{ object|help_text:'persons_responsible_structures' }}
-
@@ -138,7 +139,7 @@
- {{ object|help_text:'suspended_structures' }}
-
- {{ object.suspended_structures|yesno|title }}
+ {{ object.suspended_structures|yesnoi:'invert' }}
diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py
index 28bb5237..2ee81a82 100644
--- a/RIGS/templatetags/filters.py
+++ b/RIGS/templatetags/filters.py
@@ -8,6 +8,7 @@ from django.utils.safestring import SafeData, mark_safe
from django.utils.html import escape
from RIGS import models
import json
+from django.template.defaultfilters import yesno, title
register = template.Library()
@@ -115,6 +116,8 @@ def orderby(request, field, attr):
return dict_.urlencode()
# Used for accessing outside of a form, i.e. in detail views of RiskAssessment and EventChecklist
+
+
@register.filter
def help_text(obj, field):
if hasattr(obj, '_meta'):
@@ -149,3 +152,16 @@ def next(alist, current_index):
return alist[int(current_index) + 1] # access the next element
except BaseException:
return '' # return empty string in case of exception
+
+
+@register.filter(needs_autoescape=True)
+def yesnoi(boolean, invert=False, autoescape=True):
+ value = yesno(boolean)
+ value = title(value)
+ if invert:
+ boolean = not boolean
+ if boolean:
+ value += ' '
+ else:
+ value += ' '
+ return mark_safe(value)