diff --git a/RIGS/hs.py b/RIGS/hs.py index 68d0a3d3..db6c0177 100644 --- a/RIGS/hs.py +++ b/RIGS/hs.py @@ -141,3 +141,12 @@ class EventChecklistList(generic.ListView): paginate_by = 20 model = models.EventChecklist template_name = 'event_checklist_list.html' + + +class HSList(generic.ListView): + paginate_by = 20 + model = models.Event + template_name = 'hs_list.html' + + def get_queryset(self): + return models.Event.objects.all().order_by('-start_date') diff --git a/RIGS/migrations/0045_auto_20200824_1431.py b/RIGS/migrations/0045_auto_20200824_1431.py new file mode 100644 index 00000000..c83d402b --- /dev/null +++ b/RIGS/migrations/0045_auto_20200824_1431.py @@ -0,0 +1,54 @@ +# Generated by Django 3.0.7 on 2020-08-24 13:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('RIGS', '0044_eventchecklist'), + ] + + operations = [ + migrations.AddField( + model_name='eventchecklist', + name='medium_event', + field=models.BooleanField(default=False), + preserve_default=False, + ), + migrations.AlterField( + model_name='eventchecklist', + name='earthing', + field=models.BooleanField(help_text='Equipment appropriately earthed?
(truss, stage, etc)'), + ), + migrations.AlterField( + model_name='eventchecklist', + name='extinguishers_location', + field=models.CharField(help_text='Location of fire extinguishers', max_length=255), + ), + migrations.AlterField( + model_name='eventchecklist', + name='hs_location', + field=models.CharField(help_text='Location of Safety Bag/Box', max_length=255), + ), + migrations.AlterField( + model_name='eventchecklist', + name='safe_packing', + field=models.BooleanField(help_text='Equipment packed away safely?
(including flightcases)'), + ), + migrations.AlterField( + model_name='eventchecklist', + name='safe_parking', + field=models.BooleanField(help_text='Vehicles parked safely?
(does not obstruct venue access)'), + ), + migrations.AlterField( + model_name='eventchecklist', + name='supply_test', + field=models.BooleanField(help_text='Electrical supplies tested?
(using socket tester)'), + ), + migrations.AlterField( + model_name='eventchecklist', + name='warning_signs', + field=models.BooleanField(help_text='Warning signs in place?
(strobe, smoke, power etc.)'), + ), + ] diff --git a/RIGS/models.py b/RIGS/models.py index edef1cca..4de900e9 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -642,13 +642,13 @@ class RiskAssessment(models.Model, RevisionMixin): @reversion.register class EventChecklist(models.Model, RevisionMixin): + event = models.OneToOneField('Event', on_delete=models.CASCADE) # General power_mic = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='checklist', blank=True, null=True, verbose_name="Power MIC", on_delete=models.CASCADE, help_text="Who is the Power MIC?") - # TODO Tabular format - vehicles = models.TextField(help_text="List vehicles and their drivers") + vehicles = models.JSONField(help_text="List vehicles and their drivers", default=dict, null=False) # Safety Checks safe_parking = models.BooleanField(help_text="Vehicles parked safely?
(does not obstruct venue access)") @@ -668,6 +668,9 @@ class EventChecklist(models.Model, RevisionMixin): earthing = models.BooleanField(help_text="Equipment appropriately earthed?
(truss, stage, etc)") pat = models.BooleanField(help_text="All equipment in PAT period?") + medium_event = models.BooleanField() + # Medium Electrical Checks + @property def activity_feed_string(self): return str(self.event) diff --git a/RIGS/templates/base_rigs.html b/RIGS/templates/base_rigs.html index 3f5b5026..a9e44ac7 100644 --- a/RIGS/templates/base_rigs.html +++ b/RIGS/templates/base_rigs.html @@ -59,8 +59,9 @@ H&S {% endif %} diff --git a/RIGS/templates/event_checklist_detail.html b/RIGS/templates/event_checklist_detail.html index 9888a68c..ff912528 100644 --- a/RIGS/templates/event_checklist_detail.html +++ b/RIGS/templates/event_checklist_detail.html @@ -16,30 +16,6 @@
General
-
{{ object|help_text:'nonstandard_equipment' }}
-
- {{ object.nonstandard_equipment|yesno|title }} -
-
{{ object|help_text:'nonstandard_use'|safe }}
-
- {{ object.nonstandard_use|yesno|title }} -
-
{{ object|help_text:'contractors' }}
-
- {{ object.contractors|yesno|title }} -
-
{{ object|help_text:'other_companies' }}
-
- {{ object.othercompanies|yesno|title }} -
-
{{ object|help_text:'crew_fatigue' }}
-
- {{ object.crewfatigue|yesno|title }} -
-
{{ object|help_text:'general_notes' }}
-
- {{ object.general_notes|default:'N/A'|linebreaks }} -
@@ -47,34 +23,6 @@
Power
-
{{ object|help_text:'big_power' }}
-
- {{ object.big_power|yesno|title }} -
-
{{ object|help_text:'power_mic' }}
-
- {{ object.power_mic.name|default:'None' }} -
-
{{ object|help_text:'generators' }}
-
- {{ object.generators|yesno|title }} -
-
{{ object|help_text:'other_companies_power' }}
-
- {{ object.other_companies_power|yesno|title }} -
-
{{ object|help_text:'nonstandard_equipment_power' }}
-
- {{ object.nonstandard_equipment_power|yesno|title }} -
-
{{ object|help_text:'multiple_electrical_environments' }}
-
- {{ object.multiple_electrical_environments|yesno|title }} -
-
{{ object|help_text:'power_notes' }}
-
- {{ object.power_notes|default:'N/A'|linebreaks }} -
@@ -82,14 +30,6 @@
Sound
-
{{ object|help_text:'noise_monitoring' }}
-
- {{ object.noise_monitoring|yesno|title }} -
-
{{ object|help_text:'sound_notes' }}
-
- {{ object.sound_notes|default:'N/A'|linebreaks }} -
@@ -97,50 +37,12 @@
Site Details
-
{{ object|help_text:'known_venue' }}
-
- {{ object.known_venue|yesno|title }} -
-
{{ object|help_text:'safe_loading'|safe }}
-
- {{ object.safe_loading.name|yesno|title }} -
-
{{ object|help_text:'safe_storage' }}
-
- {{ object.safe_storage|yesno|title }} -
-
{{ object|help_text:'area_outside_of_control' }}
-
- {{ object.area_outside_of_control|yesno|title }} -
-
{{ object|help_text:'barrier_required' }}
-
- {{ object.barrier_required|yesno|title }} -
-
{{ object|help_text:'nonstandard_emergency_procedure' }}
-
- {{ object.nonstandard_emergency_procedure|yesno|title }} -
Structures
-
-
{{ object|help_text:'special_structures' }}
-
- {{ object.special_structures|yesno|title }} -
-
{{ object|help_text:'persons_responsible_structures' }}
-
- {{ object.persons_responsible_structures.name|default:'N/A'|linebreaks }} -
-
{{ object|help_text:'suspended_structures' }}
-
- {{ object.suspended_structures|yesno|title }} -
-
diff --git a/RIGS/templates/event_checklist_form.html b/RIGS/templates/event_checklist_form.html index 0215b42a..37822adb 100644 --- a/RIGS/templates/event_checklist_form.html +++ b/RIGS/templates/event_checklist_form.html @@ -25,6 +25,38 @@ + + {% endblock %} {% block content %} @@ -64,6 +96,8 @@ + @@ -73,13 +107,10 @@ {% for i in '012'|make_list %} - - + + @@ -152,6 +183,18 @@
+
+
+
Event Size
+
+ {% render_field form.medium_event style="display: none" %} + + +
+
+
+
+
Electrical Checks for ‘Small’ TEC Events <6kVA (aprox. 26A)
@@ -164,7 +207,7 @@
-
+
Electrical Checks for ‘Medium’ TEC Events
diff --git a/RIGS/templates/hs_list.html b/RIGS/templates/hs_list.html new file mode 100644 index 00000000..e59b6490 --- /dev/null +++ b/RIGS/templates/hs_list.html @@ -0,0 +1,59 @@ +{% extends 'base_rigs.html' %} +{% load paginator from filters %} + +{% block title %}H&S Overview{% endblock %} + +{% block content %} +
+
-
+ + + + + + + + + + {% for event in object_list %} + + + + + + + + {% empty %} + + + + {% endfor %} + +
EventDatesRAChecklist
{{ event.pk }} | {{ event.name }} +
{{ event.start_date|date:"D d/m/Y" }}
+ {% if event.end_date and event.end_date != event.start_date %} +
{{ event.end_date|date:"D d/m/Y" }}
+ {% endif %} +
+ {% if event.riskassessment %} + View + {% if event.riskassessment.reviewed_by %} + Reviewed by {{ event.riskassessment.reviewed_by }} at {{ event.riskassessment.reviewed_at }} + {% else %} + Mark Reviewed + {% endif %} + {% else %} + + {% endif %} + + +
No events found
+ {% if is_paginated %} +
+ {% paginator %} +
+ {% endif %} + +{% endblock %} diff --git a/RIGS/urls.py b/RIGS/urls.py index 5e470736..a1436fae 100644 --- a/RIGS/urls.py +++ b/RIGS/urls.py @@ -91,6 +91,8 @@ urlpatterns = [ name='event_history', kwargs={'model': models.Event}), # Event H&S + path('event/hs/', permission_required_with_403('RIGS.change_event')(hs.HSList.as_view()), name='hs_list'), + path('event//ra/', permission_required_with_403('RIGS.change_event')(hs.EventRiskAssessmentCreate.as_view()), name='event_ra'), path('event/ra//', permission_required_with_403('RIGS.change_event')(hs.EventRiskAssessmentDetail.as_view()), diff --git a/requirements.txt b/requirements.txt index dd1683e8..5b5b37b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ cssutils==1.0.2 diff-match-patch==20181111 dj-database-url==0.5.0 dj-static==0.0.6 -Django==3.0.7 +Django==3.1 django-debug-toolbar==2.2 django-filter==2.3.0 django-gulp==4.1.0