Cleanup & Squash migrations

This commit is contained in:
2020-09-15 09:30:02 +01:00
parent 5487b73006
commit a5516ee350
24 changed files with 219 additions and 937 deletions

View File

@@ -11,6 +11,7 @@ from captcha.fields import ReCaptchaField
from reversion import revisions as reversion
import simplejson
from datetime import datetime
from django.utils import timezone
from RIGS import models
@@ -182,6 +183,13 @@ class EventChecklistForm(forms.ModelForm):
# Parsed from incoming form data by clean, then saved into models when the form is saved
items = {}
# Two possible formats
def parsedatetime(self, date_string):
try:
return timezone.make_aware(datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S'))
except ValueError:
return timezone.make_aware(datetime.strptime(date_string, '%Y-%m-%dT%H:%M'))
# There's probably a thousand better ways to do this, but this one is mine
def clean(self):
vehicles = {key: val for key, val in self.data.items()
@@ -221,9 +229,9 @@ class EventChecklistForm(forms.ModelForm):
item = models.EventChecklistCrew()
item.crewmember = models.Profile.objects.get(pk=self.data['crewmember_' + str(pk)])
item.start = self.data['start_' + str(pk)]
item.start = self.parsedatetime(self.data['start_' + str(pk)])
item.role = self.data['role_' + str(pk)]
item.end = self.data['end_' + str(pk)]
item.end = self.parsedatetime(self.data['end_' + str(pk)])
item.full_clean('checklist')
# item does not have a database pk yet as it isn't saved

View File

@@ -0,0 +1,181 @@
# Generated by Django 3.1 on 2020-09-15 08:37
import RIGS.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0038_auto_20200306_2000'),
]
operations = [
migrations.CreateModel(
name='EventChecklist',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('safe_parking', models.BooleanField(help_text='Vehicles parked safely?<br><small>(does not obstruct venue access)</small>')),
('safe_packing', models.BooleanField(help_text='Equipment packed away safely?<br><small>(including flightcases)</small>')),
('exits', models.BooleanField(help_text='Emergency exits clear?')),
('trip_hazard', models.BooleanField(help_text='Appropriate barriers around kit and cabling secured?')),
('warning_signs', models.BooleanField(help_text='Warning signs in place?<br><small>(strobe, smoke, power etc.)</small>')),
('ear_plugs', models.BooleanField(help_text='Ear plugs issued to crew where needed?')),
('hs_location', models.CharField(help_text='Location of Safety Bag/Box', max_length=255)),
('extinguishers_location', models.CharField(help_text='Location of fire extinguishers', max_length=255)),
('rcds', models.BooleanField(blank=True, help_text='RCDs installed where needed and tested?', null=True)),
('supply_test', models.BooleanField(blank=True, help_text='Electrical supplies tested?<br><small>(using socket tester)</small>', null=True)),
('earthing', models.BooleanField(help_text='Equipment appropriately earthed?<br><small>(truss, stage, generators etc)</small>')),
('pat', models.BooleanField(help_text='All equipment in PAT period?')),
('medium_event', models.BooleanField()),
('source_rcd', models.BooleanField(blank=True, help_text='Source RCD protected?<br><small>(if cable is more than 3m long) </small>', null=True)),
('labelling', models.BooleanField(blank=True, help_text='Appropriate and clear labelling on distribution and cabling?', null=True)),
('fd_voltage_l1', models.IntegerField(blank=True, help_text='L1 - N', null=True, verbose_name='First Distro Voltage L1-N')),
('fd_voltage_l2', models.IntegerField(blank=True, help_text='L2 - N', null=True, verbose_name='First Distro Voltage L2-N')),
('fd_voltage_l3', models.IntegerField(blank=True, help_text='L3 - N', null=True, verbose_name='First Distro Voltage L3-N')),
('fd_phase_rotation', models.BooleanField(blank=True, help_text='Phase Rotation<br><small>(if required)</small>', null=True, verbose_name='Phase Rotation')),
('fd_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True, verbose_name='Earth Fault Loop Impedance')),
('fd_pssc', models.IntegerField(blank=True, help_text='Prospective Short Circuit Current', null=True, verbose_name='PSCC')),
('w1_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
('w1_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
('w1_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
('w1_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
('w2_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
('w2_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
('w2_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
('w2_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
('w3_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
('w3_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
('w3_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
('w3_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
('all_rcds_tested', models.BooleanField(blank=True, help_text='All circuit RCDs tested?<br><small>(using test button)</small>', null=True)),
('public_sockets_tested', models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?<br><small>(using socket tester)</small>', null=True)),
('reviewed_at', models.DateTimeField(null=True)),
],
options={
'ordering': ['event'],
'permissions': [('review_eventchecklist', 'Can review Event Checklists')],
},
bases=(models.Model, RIGS.models.RevisionMixin),
),
migrations.CreateModel(
name='EventChecklistCrew',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role', models.CharField(max_length=255)),
('start', models.DateTimeField()),
('end', models.DateTimeField()),
('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='crew', to='RIGS.eventchecklist')),
],
bases=(models.Model, RIGS.models.RevisionMixin),
),
migrations.CreateModel(
name='EventChecklistVehicle',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vehicle', models.CharField(max_length=255)),
('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to='RIGS.eventchecklist')),
],
bases=(models.Model, RIGS.models.RevisionMixin),
),
migrations.CreateModel(
name='RiskAssessment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nonstandard_equipment', models.BooleanField(help_text="Does the event require any hired in equipment or use of equipment that is not covered by TEC's standard risk assessments and method statements?")),
('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?')),
('other_companies', models.BooleanField(help_text='Are TEC working with any other companies on site?')),
('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, 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?', null=True)),
('big_power', models.BooleanField(help_text='Does the event require larger power supplies than 13A or 16A single phase wall sockets, or draw more than 20A total current?')),
('generators', models.BooleanField(help_text='Will generators be used?')),
('other_companies_power', models.BooleanField(help_text='Will TEC be supplying power to any other companies?')),
('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, 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?', null=True)),
('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?')),
('sound_notes', models.TextField(blank=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?', null=True)),
('known_venue', models.BooleanField(help_text='Is the event in a venue that you and/or TEC have experience working in?')),
('safe_loading', models.BooleanField(help_text='Is there a safe load in/out?<br><small>e.g. sufficient lighting, flat, not in a crowded area etc.</small>')),
('safe_storage', models.BooleanField(help_text='Are there areas to safely store equipment?')),
('area_outside_of_control', models.BooleanField(help_text="Is any part of the work area out of TEC's direct control or openly accessible during the build or breakdown period?")),
('barrier_required', models.BooleanField(help_text='Is there a requirement for TEC to provide any barrier for security or protection of persons/equipment?')),
('nonstandard_emergency_procedure', models.BooleanField(help_text="Does the emergency procedure for the event differ from TEC's standard procedures?")),
('special_structures', models.BooleanField(help_text='Does the event require use of winch stands, motors, MPT Towers, or staging?')),
('persons_responsible_structures', models.TextField(blank=True, help_text='Who are the persons on site responsible for their use?', null=True)),
('suspended_structures', models.BooleanField(help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?")),
('reviewed_at', models.DateTimeField(null=True)),
],
options={
'ordering': ['event'],
'permissions': [('review_riskassessment', 'Can review Risk Assessments')],
},
bases=(models.Model, RIGS.models.RevisionMixin),
),
migrations.RemoveField(
model_name='eventcrew',
name='event',
),
migrations.RemoveField(
model_name='eventcrew',
name='user',
),
migrations.DeleteModel(
name='RIGSVersion',
),
migrations.RemoveField(
model_name='event',
name='risk_assessment_edit_url',
),
migrations.AlterField(
model_name='profile',
name='first_name',
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
),
migrations.DeleteModel(
name='EventCrew',
),
migrations.AddField(
model_name='riskassessment',
name='event',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='RIGS.event'),
),
migrations.AddField(
model_name='riskassessment',
name='power_mic',
field=models.ForeignKey(blank=True, help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='power_mic', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC'),
),
migrations.AddField(
model_name='riskassessment',
name='reviewed_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
),
migrations.AddField(
model_name='eventchecklistvehicle',
name='driver',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='eventchecklistcrew',
name='crewmember',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='crewed', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='eventchecklist',
name='event',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='RIGS.event'),
),
migrations.AddField(
model_name='eventchecklist',
name='power_mic',
field=models.ForeignKey(help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='checklists', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC'),
),
migrations.AddField(
model_name='eventchecklist',
name='reviewed_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
),
]

View File

@@ -1,16 +0,0 @@
# Generated by Django 3.0.3 on 2020-03-18 00:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0038_auto_20200306_2000'),
]
operations = [
migrations.DeleteModel(
name='EventCrew',
),
]

View File

@@ -1,16 +0,0 @@
# Generated by Django 3.0.3 on 2020-04-15 18:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0039_delete_eventcrew'),
]
operations = [
migrations.DeleteModel(
name='RIGSVersion',
),
]

View File

@@ -1,50 +0,0 @@
# Generated by Django 3.0.3 on 2020-05-28 21:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0040_delete_rigsversion'),
]
operations = [
migrations.RemoveField(
model_name='event',
name='risk_assessment_edit_url',
),
migrations.CreateModel(
name='RiskAssessment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nonstandard_equipment', models.BooleanField(default=False, help_text="Does the event require any hired in equipment or use of equipment that is not covered by TEC's standard risk assessments and method statements?")),
('nonstandard_use', models.BooleanField(default=False, 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(default=False, help_text='Are you using any external contractors?')),
('other_companies', models.BooleanField(default=False, help_text='Are TEC working with any other companies on site?')),
('crew_fatigue', models.BooleanField(default=False, help_text='Is crew fatigue likely to be a risk at any point during this event?')),
('general_notes', models.TextField(blank=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?', null=True)),
('big_power', models.BooleanField(default=False, help_text='Does the event require larger power supplies than 13A or 16A single phase wall sockets, or draw more than 20A total current?')),
('generators', models.BooleanField(default=False, help_text='Will generators be used?')),
('other_companies_power', models.BooleanField(default=False, help_text='Will TEC be supplying power to any other companies?')),
('nonstandard_equipment_power', models.BooleanField(default=False, 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(default=False, help_text='Will the electrical installation occupy more than one electrical environment?')),
('power_notes', models.TextField(blank=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?', null=True)),
('noise_monitoring', models.BooleanField(default=False, 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?')),
('sound_notes', models.TextField(blank=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?', null=True)),
('known_venue', models.BooleanField(default=False, help_text='Is the event in a venue that you and/or TEC have experience working in?')),
('safe_loading', models.BooleanField(default=False, help_text='Is there a safe load in/out?<br><small>e.g. sufficient lighting, flat, not in a crowded area etc.</small>')),
('safe_storage', models.BooleanField(default=False, help_text='Are there areas to safely store equipment?')),
('area_outside_of_control', models.BooleanField(default=False, help_text="Is any part of the work area out of TEC's direct control or openly accessible during the build or breakdown period?")),
('barrier_required', models.BooleanField(default=False, help_text='Is there a requirement for TEC to provide any barrier for security or protection of persons/equipment?')),
('nonstandard_emergency_procedure', models.BooleanField(default=False, help_text="Does the emergency procedure for the event differ from TEC's standard procedures?")),
('special_structures', models.BooleanField(default=False, help_text='Does the event require use of winch stands, motors, MPT Towers, or staging?')),
('persons_responsible_structures', models.TextField(blank=True, help_text='Who are the persons on site responsible for their use?', null=True)),
('suspended_structures', models.BooleanField(default=False, help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?")),
('event', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='RIGS.Event')),
('power_mic', models.ForeignKey(blank=True, help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='power_mic', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC')),
],
),
]

View File

@@ -1,108 +0,0 @@
# Generated by Django 3.0.7 on 2020-07-03 14:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0041_auto_20200528_2253'),
]
operations = [
migrations.AlterField(
model_name='riskassessment',
name='area_outside_of_control',
field=models.BooleanField(help_text="Is any part of the work area out of TEC's direct control or openly accessible during the build or breakdown period?"),
),
migrations.AlterField(
model_name='riskassessment',
name='barrier_required',
field=models.BooleanField(help_text='Is there a requirement for TEC to provide any barrier for security or protection of persons/equipment?'),
),
migrations.AlterField(
model_name='riskassessment',
name='big_power',
field=models.BooleanField(help_text='Does the event require larger power supplies than 13A or 16A single phase wall sockets, or draw more than 20A total current?'),
),
migrations.AlterField(
model_name='riskassessment',
name='contractors',
field=models.BooleanField(help_text='Are you using any external contractors?'),
),
migrations.AlterField(
model_name='riskassessment',
name='crew_fatigue',
field=models.BooleanField(help_text='Is crew fatigue likely to be a risk at any point during this event?'),
),
migrations.AlterField(
model_name='riskassessment',
name='generators',
field=models.BooleanField(help_text='Will generators be used?'),
),
migrations.AlterField(
model_name='riskassessment',
name='known_venue',
field=models.BooleanField(help_text='Is the event in a venue that you and/or TEC have experience working in?'),
),
migrations.AlterField(
model_name='riskassessment',
name='multiple_electrical_environments',
field=models.BooleanField(help_text='Will the electrical installation occupy more than one electrical environment?'),
),
migrations.AlterField(
model_name='riskassessment',
name='noise_monitoring',
field=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?'),
),
migrations.AlterField(
model_name='riskassessment',
name='nonstandard_emergency_procedure',
field=models.BooleanField(help_text="Does the emergency procedure for the event differ from TEC's standard procedures?"),
),
migrations.AlterField(
model_name='riskassessment',
name='nonstandard_equipment',
field=models.BooleanField(help_text="Does the event require any hired in equipment or use of equipment that is not covered by TEC's standard risk assessments and method statements?"),
),
migrations.AlterField(
model_name='riskassessment',
name='nonstandard_equipment_power',
field=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?'),
),
migrations.AlterField(
model_name='riskassessment',
name='nonstandard_use',
field=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>'),
),
migrations.AlterField(
model_name='riskassessment',
name='other_companies',
field=models.BooleanField(help_text='Are TEC working with any other companies on site?'),
),
migrations.AlterField(
model_name='riskassessment',
name='other_companies_power',
field=models.BooleanField(help_text='Will TEC be supplying power to any other companies?'),
),
migrations.AlterField(
model_name='riskassessment',
name='safe_loading',
field=models.BooleanField(help_text='Is there a safe load in/out?<br><small>e.g. sufficient lighting, flat, not in a crowded area etc.</small>'),
),
migrations.AlterField(
model_name='riskassessment',
name='safe_storage',
field=models.BooleanField(help_text='Are there areas to safely store equipment?'),
),
migrations.AlterField(
model_name='riskassessment',
name='special_structures',
field=models.BooleanField(help_text='Does the event require use of winch stands, motors, MPT Towers, or staging?'),
),
migrations.AlterField(
model_name='riskassessment',
name='suspended_structures',
field=models.BooleanField(help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?"),
),
]

View File

@@ -1,25 +0,0 @@
# Generated by Django 3.0.7 on 2020-08-05 15:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0042_auto_20200703_1513'),
]
operations = [
migrations.AddField(
model_name='riskassessment',
name='reviewed_at',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='riskassessment',
name='reviewed_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
),
]

View File

@@ -1,38 +0,0 @@
# Generated by Django 3.0.7 on 2020-08-14 15:28
import RIGS.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0043_auto_20200805_1606'),
]
operations = [
migrations.CreateModel(
name='EventChecklist',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vehicles', models.TextField(help_text='List vehicles and their drivers')),
('safe_parking', models.BooleanField(help_text='Vehicles parked safely?<small>(does not obstruct venue access)</small>')),
('safe_packing', models.BooleanField(help_text='Equipment packed away safely?<small>(including flightcases)</small>')),
('exits', models.BooleanField(help_text='Emergency exits clear?')),
('trip_hazard', models.BooleanField(help_text='Appropriate barriers around kit and cabling secured?')),
('warning_signs', models.BooleanField(help_text='Warning signs in place?<small>(strobe, smoke, power etc.)</small>')),
('ear_plugs', models.BooleanField(help_text='Ear plugs issued to crew where needed?')),
('hs_location', models.TextField(help_text='Location of Safety Bag/Box')),
('extinguishers_location', models.TextField(help_text='Location of fire extinguishers')),
('rcds', models.BooleanField(help_text='RCDs installed where needed and tested?')),
('supply_test', models.BooleanField(help_text='Electrical supplies tested?<small>(using socket tester)</small>')),
('earthing', models.BooleanField(help_text='Equipment appropriately earthed?<small>(truss, stage, etc)</small>')),
('pat', models.BooleanField(help_text='All equipment in PAT period?')),
('event', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='RIGS.Event')),
('power_mic', models.ForeignKey(blank=True, help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='checklist', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC')),
],
bases=(models.Model, RIGS.models.RevisionMixin),
),
]

View File

@@ -1,54 +0,0 @@
# 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?<br><small>(truss, stage, etc)</small>'),
),
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?<br><small>(including flightcases)</small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='safe_parking',
field=models.BooleanField(help_text='Vehicles parked safely?<br><small>(does not obstruct venue access)</small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='supply_test',
field=models.BooleanField(help_text='Electrical supplies tested?<br><small>(using socket tester)</small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='warning_signs',
field=models.BooleanField(help_text='Warning signs in place?<br><small>(strobe, smoke, power etc.)</small>'),
),
]

View File

@@ -1,38 +0,0 @@
# Generated by Django 3.1 on 2020-08-28 11:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0045_auto_20200824_1431'),
]
operations = [
migrations.RemoveField(
model_name='eventchecklist',
name='vehicles',
),
migrations.AlterField(
model_name='eventchecklist',
name='power_mic',
field=models.ForeignKey(help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='checklists', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC'),
),
migrations.AlterField(
model_name='profile',
name='first_name',
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
),
migrations.CreateModel(
name='EventChecklistVehicle',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vehicle', models.CharField(max_length=255)),
('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to='RIGS.eventchecklist')),
('driver', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='drivers', to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@@ -1,31 +0,0 @@
# Generated by Django 3.1 on 2020-08-29 20:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0046_auto_20200828_1246'),
]
operations = [
migrations.AlterField(
model_name='eventchecklistvehicle',
name='driver',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to=settings.AUTH_USER_MODEL),
),
migrations.CreateModel(
name='EventChecklistCrew',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role', models.CharField(max_length=255, null=True)),
('start', models.DateTimeField(blank=True, null=True)),
('end', models.DateTimeField(blank=True, null=True)),
('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='crew', to='RIGS.eventchecklist')),
('crewmember', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='crewed', to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@@ -1,31 +0,0 @@
# Generated by Django 3.1 on 2020-08-29 21:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0047_auto_20200829_2105'),
]
operations = [
migrations.AlterField(
model_name='eventchecklistcrew',
name='end',
field=models.DateTimeField(default=None),
preserve_default=False,
),
migrations.AlterField(
model_name='eventchecklistcrew',
name='role',
field=models.CharField(default=None, max_length=255),
preserve_default=False,
),
migrations.AlterField(
model_name='eventchecklistcrew',
name='start',
field=models.DateTimeField(default=None),
preserve_default=False,
),
]

View File

@@ -1,78 +0,0 @@
# Generated by Django 3.1 on 2020-08-29 22:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0048_auto_20200829_2201'),
]
operations = [
migrations.AddField(
model_name='eventchecklist',
name='all_rcds_tested',
field=models.BooleanField(default=False, help_text='All circuit RCDs tested?<small>(using test button)</small>'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_earth_fault',
field=models.IntegerField(default=False, help_text='Earth Fault Loop Impedance (Z<small>S</small>)'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_phase_rotation',
field=models.BooleanField(default=False, help_text='Phase Rotation<br><small>(if required)</small>'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_pssc',
field=models.IntegerField(default=False, help_text='Prospective Short Circuit Current'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_voltage_l1',
field=models.IntegerField(default=False),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_voltage_l2',
field=models.IntegerField(default=False),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='fd_voltage_l3',
field=models.IntegerField(default=False),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='labelling',
field=models.BooleanField(default=False, help_text='Appropriate and clear labelling on distribution and cabling?'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='public_sockets_tested',
field=models.BooleanField(default=False, help_text='Public/Performer accessible circuits tested?<small>(using socket tester)</small>'),
preserve_default=False,
),
migrations.AddField(
model_name='eventchecklist',
name='source_rcd',
field=models.BooleanField(default=False, help_text='Source RCD protected?<br><small>(if cable is more than 3m long) </small>'),
preserve_default=False,
),
migrations.AlterField(
model_name='eventchecklist',
name='earthing',
field=models.BooleanField(help_text='Equipment appropriately earthed?<br><small>(truss, stage, generators etc)</small>'),
),
]

View File

@@ -1,43 +0,0 @@
# Generated by Django 3.1 on 2020-08-30 09:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0049_auto_20200829_2313'),
]
operations = [
migrations.AlterField(
model_name='eventchecklist',
name='fd_earth_fault',
field=models.IntegerField(help_text='Earth Fault Loop Impedance (Z<small>S</small>)', verbose_name='Earth Fault Loop Impedance'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_phase_rotation',
field=models.BooleanField(help_text='Phase Rotation<br><small>(if required)</small>', verbose_name='Phase Rotation'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_pssc',
field=models.IntegerField(help_text='Prospective Short Circuit Current', verbose_name='PSCC'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l1',
field=models.IntegerField(help_text='L1 - N', verbose_name='First Distro Voltage L1-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l2',
field=models.IntegerField(help_text='L2 - N', verbose_name='First Distro Voltage L2-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l3',
field=models.IntegerField(help_text='L3 - N', verbose_name='First Distro Voltage L3-N'),
),
]

View File

@@ -1,73 +0,0 @@
# Generated by Django 3.1 on 2020-08-30 10:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0050_auto_20200830_1048'),
]
operations = [
migrations.AlterField(
model_name='eventchecklist',
name='all_rcds_tested',
field=models.BooleanField(blank=True, help_text='All circuit RCDs tested?<small>(using test button)</small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_earth_fault',
field=models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', verbose_name='Earth Fault Loop Impedance'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_phase_rotation',
field=models.BooleanField(blank=True, help_text='Phase Rotation<br><small>(if required)</small>', verbose_name='Phase Rotation'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_pssc',
field=models.IntegerField(blank=True, help_text='Prospective Short Circuit Current', verbose_name='PSCC'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l1',
field=models.IntegerField(blank=True, help_text='L1 - N', verbose_name='First Distro Voltage L1-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l2',
field=models.IntegerField(blank=True, help_text='L2 - N', verbose_name='First Distro Voltage L2-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l3',
field=models.IntegerField(blank=True, help_text='L3 - N', verbose_name='First Distro Voltage L3-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='labelling',
field=models.BooleanField(blank=True, help_text='Appropriate and clear labelling on distribution and cabling?'),
),
migrations.AlterField(
model_name='eventchecklist',
name='public_sockets_tested',
field=models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?<small>(using socket tester)</small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='rcds',
field=models.BooleanField(blank=True, help_text='RCDs installed where needed and tested?'),
),
migrations.AlterField(
model_name='eventchecklist',
name='source_rcd',
field=models.BooleanField(blank=True, help_text='Source RCD protected?<br><small>(if cable is more than 3m long) </small>'),
),
migrations.AlterField(
model_name='eventchecklist',
name='supply_test',
field=models.BooleanField(blank=True, help_text='Electrical supplies tested?<br><small>(using socket tester)</small>'),
),
]

View File

@@ -1,73 +0,0 @@
# Generated by Django 3.1 on 2020-08-30 10:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0051_auto_20200830_1115'),
]
operations = [
migrations.AlterField(
model_name='eventchecklist',
name='all_rcds_tested',
field=models.BooleanField(blank=True, help_text='All circuit RCDs tested?<small>(using test button)</small>', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_earth_fault',
field=models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True, verbose_name='Earth Fault Loop Impedance'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_phase_rotation',
field=models.BooleanField(blank=True, help_text='Phase Rotation<br><small>(if required)</small>', null=True, verbose_name='Phase Rotation'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_pssc',
field=models.IntegerField(blank=True, help_text='Prospective Short Circuit Current', null=True, verbose_name='PSCC'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l1',
field=models.IntegerField(blank=True, help_text='L1 - N', null=True, verbose_name='First Distro Voltage L1-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l2',
field=models.IntegerField(blank=True, help_text='L2 - N', null=True, verbose_name='First Distro Voltage L2-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='fd_voltage_l3',
field=models.IntegerField(blank=True, help_text='L3 - N', null=True, verbose_name='First Distro Voltage L3-N'),
),
migrations.AlterField(
model_name='eventchecklist',
name='labelling',
field=models.BooleanField(blank=True, help_text='Appropriate and clear labelling on distribution and cabling?', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='public_sockets_tested',
field=models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?<small>(using socket tester)</small>', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='rcds',
field=models.BooleanField(blank=True, help_text='RCDs installed where needed and tested?', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='source_rcd',
field=models.BooleanField(blank=True, help_text='Source RCD protected?<br><small>(if cable is more than 3m long) </small>', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='supply_test',
field=models.BooleanField(blank=True, help_text='Electrical supplies tested?<br><small>(using socket tester)</small>', null=True),
),
]

View File

@@ -1,83 +0,0 @@
# 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 (Z<small>S</small>)', 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 (Z<small>S</small>)', 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 (Z<small>S</small>)', 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?<br><small>(using test button)</small>', null=True),
),
migrations.AlterField(
model_name='eventchecklist',
name='public_sockets_tested',
field=models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?<br><small>(using socket tester)</small>', null=True),
),
]

View File

@@ -1,33 +0,0 @@
# Generated by Django 3.1 on 2020-08-31 11:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0053_auto_20200830_1940'),
]
operations = [
migrations.AlterModelOptions(
name='eventchecklist',
options={'ordering': ['event'], 'permissions': [('eventchecklist_review', 'Can review ECs')]},
),
migrations.AlterModelOptions(
name='riskassessment',
options={'ordering': ['event'], 'permissions': [('riskassessment_review', 'Can review RAs')]},
),
migrations.AddField(
model_name='eventchecklist',
name='reviewed_at',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='eventchecklist',
name='reviewed_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
),
]

View File

@@ -1,21 +0,0 @@
# Generated by Django 3.1 on 2020-09-12 08:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0054_auto_20200831_1218'),
]
operations = [
migrations.AlterModelOptions(
name='eventchecklist',
options={'ordering': ['event'], 'permissions': [('review_eventchecklist', 'Can review Event Checklists')]},
),
migrations.AlterModelOptions(
name='riskassessment',
options={'ordering': ['event'], 'permissions': [('review_riskassessment', 'Can review Risk Assessments')]},
),
]

View File

@@ -781,5 +781,9 @@ class EventChecklistCrew(models.Model, RevisionMixin):
reversion_hide = True
def clean(self):
if self.start > self.end:
raise ValidationError('Unless you\'ve invented time travel, crew can\'t finish before they have started.')
def __str__(self):
return "{} ({})".format(str(self.crewmember), self.role)

View File

@@ -85,8 +85,8 @@
});
//Somewhat rudimentary way of ensuring people fill in completely (if it hits the database validation the whole table row disappears when the page reloads...)
//the not is to avoid adding it to some of bootstrap-selects extra crap
$('#vehiclest,#crewmemberst').find("select,input[type!='search']").change(function () {
$(this).closest('tr').find('input,select').attr('required', 'true');
$('#vehiclest,#crewmemberst').find("select,input").not(':input[type=search]').change(function () {
$(this).closest('tr').find("select,input").not(':input[type=search]').attr('required', 'true');
});
});
</script>
@@ -141,7 +141,7 @@
<tr id="vehicles_new" style="display: none;">
<td><input type="text" class="form-control" name="vehicle_new" disabled="true"/></td>
<td><select class="form-control" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials" name="driver_new" disabled="true"></select></td>
<td><button class="btn btn-danger" data-action='delete' data-target='#vehicle'><span class="fas fa-times"></span></button</td>
<td><button type="button" class="btn btn-danger" data-action='delete' data-target='#vehicle'><span class="fas fa-times"></span></button</td>
</tr>
{% for i in object.vehicles.all %}
<tr id="vehicles_{{i.pk}}">
@@ -153,13 +153,13 @@
{% endif %}
</select>
</td>
<td><button class="btn btn-danger" data-id='{{i.pk}}' data-action='delete' data-target='#vehicle'><span class="fas fa-times"></span></button</td>
<td><button type="button" class="btn btn-danger" data-id='{{i.pk}}' data-action='delete' data-target='#vehicle'><span class="fas fa-times"></span></button</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="text-right">
<button class="btn btn-secondary" id="vehicle-add" data-action='add' data-target='#vehiclest' data-clone='#vehicles_new'><span class="fas fa-plus"></span> Add Vehicle</button>
<button type="button" class="btn btn-secondary" id="vehicle-add" data-action='add' data-target='#vehiclest' data-clone='#vehicles_new'><span class="fas fa-plus"></span> Add Vehicle</button>
</div>
</div>
</div>
@@ -207,7 +207,7 @@
<td><input name="start_new" type="datetime-local" class="form-control" value="{{ i.start }}" disabled="true"/></td>
<td><input name="role_new" type="text" class="form-control" value="{{ i.role }}" disabled="true"/></td>
<td><input name="end_new" type="datetime-local" class="form-control" value="{{ i.end }}" disabled="true" /></td>
<td><button class="btn btn-danger" data-id='{{crew.pk}}' data-action='delete' data-target='#crewmember'><span class="fas fa-times"></span></button</td>
<td><button type="button" class="btn btn-danger" data-id='{{crew.pk}}' data-action='delete' data-target='#crewmember'><span class="fas fa-times"></span></button</td>
</tr>
{% for crew in object.crew.all %}
<tr id="crew_{{crew.pk}}">
@@ -221,13 +221,13 @@
<td><input name="start_{{crew.pk}}" type="datetime-local" class="form-control" value="{{ crew.start|date:'Y-m-d' }}T{{ crew.start|date:'H:i:s' }}"/></td>
<td><input name="role_{{crew.pk}}" type="text" class="form-control" value="{{ crew.role }}"/></td>
<td><input name="end_{{crew.pk}}" type="datetime-local" class="form-control" value="{{ crew.end|date:'Y-m-d' }}T{{ crew.end|date:'H:i:s' }}"/></td>
<td><button class="btn btn-danger" data-id='{{crew.pk}}' data-action='delete' data-target='#crewmember'><span class="fas fa-times"></span></button</td>
<td><button type="button" class="btn btn-danger" data-id='{{crew.pk}}' data-action='delete' data-target='#crewmember'><span class="fas fa-times"></span></button</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="text-right">
<button class="btn btn-secondary" data-action='add' data-target='#crewmemberst' data-clone='#crew_new'><span class="fas fa-plus"></span> Add Crewmember</button>
<button type="button" class="btn btn-secondary" data-action='add' data-target='#crewmemberst' data-clone='#crew_new'><span class="fas fa-plus"></span> Add Crewmember</button>
</div>
</div>
</div>

View File

@@ -150,18 +150,15 @@
{# New rig buttons #}
{% if not object.pk %}
<div class="col-sm-12">
<div class="card row align-items-center">
<div class="card-body" id="is_rig-selector">
<div class="card text-center" id="is_rig-selector">
<div class="card-body">
<span data-toggle="tooltip"
title="Anything that involves TEC kit, crew, or otherwise us providing a service to anyone.">
<button type="button" class="btn btn-primary" data-is_rig="1" style="width: 10rem;">Rig</button>
<button type="button" class="btn btn-primary w-25" data-is_rig="1">Rig</button>
</span>
<span data-toggle="tooltip"
title="Things that aren't service-based, like training, meetings and site visits.">
<button type="button" class="btn btn-info" data-is_rig="0" style="width: 10rem;">Non-Rig</button>
</span>
<span data-toggle="tooltip" title="Coming soon...">
<button type="button" class="btn btn-warning" data-is_rig="-1" style="width: 10rem;">Subhire</button>
<button type="button" class="btn btn-info w-25" data-is_rig="0">Non-Rig</button>
</span>
</div>
</div>

View File

@@ -330,9 +330,6 @@ class TestEventCreate(BaseRigboardTest):
self.page.submit()
self.assertTrue(self.page.success)
def test_subhire_creation(self):
pass
@screenshot_failure_cls
class TestEventDuplicate(BaseRigboardTest):
@@ -1053,9 +1050,9 @@ class TestHealthAndSafety(BaseRigboardTest):
start_time = base_regions.DateTimePicker(self.page, self.driver.find_element(By.XPATH, '//*[@name="start_-1"]'))
end_time = base_regions.DateTimePicker(self.page, self.driver.find_element(By.XPATH, '//*[@name="end_-1"]'))
start_time.set_value(datetime.datetime(2015, 1, 1, 9, 0))
start_time.set_value(timezone.make_aware(datetime.datetime(2015, 1, 1, 9, 0)))
# TODO Validation of end before start
end_time.set_value(datetime.datetime(2015, 1, 1, 10, 30))
end_time.set_value(timezone.make_aware(datetime.datetime(2015, 1, 1, 10, 30)))
crew_select.search(crew.name)
crew_select.toggle()
self.driver.find_element(By.XPATH, '//*[@name="role_-1"]').send_keys(role)