Split power related parts of event checklist into a seperate form

This commit is contained in:
2023-05-08 19:46:35 +01:00
parent b1a2859f1b
commit e774b06ac4
12 changed files with 717 additions and 211 deletions

View File

@@ -283,3 +283,17 @@ class EventChecklistForm(forms.ModelForm):
model = models.EventChecklist
fields = '__all__'
exclude = ['reviewed_at', 'reviewed_by']
class PowerTestRecordForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for name, field in self.fields.items():
if field.__class__ == forms.NullBooleanField:
# Only display yes/no to user, the 'none' is only ever set in the background
field.widget = forms.CheckboxInput()
class Meta:
model = models.PowerTestRecord
fields = '__all__'
exclude = ['reviewed_at', 'reviewed_by']