aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/forms.py
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-08-13 11:49:04 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-08-13 11:49:04 +0100
commit5a955f9796c199338eb3182f1918c4708593a1be (patch)
treeff58dbbf9a68cb6bfef04f11386df088e558f5e9 /ctrack/caf/forms.py
parentbd7ffed3034f66c16845063667f3bea7cc0a9e9a (diff)
changed description field to funciton in ApplicableSystem
Diffstat (limited to 'ctrack/caf/forms.py')
-rw-r--r--ctrack/caf/forms.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py
index a21488a..9847f01 100644
--- a/ctrack/caf/forms.py
+++ b/ctrack/caf/forms.py
@@ -13,12 +13,13 @@ from ctrack.caf.models import CAF
from ctrack.organisations.models import Organisation
CAFCreateInlineFormset = inlineformset_factory(
- CAF, ApplicableSystem, fields=("name", "organisation"), extra=2)
+ CAF, ApplicableSystem, fields=("name", "organisation"), extra=2
+)
class ApplicableSystemCreateFromCafForm(forms.Form):
- name = forms.CharField(max_length=255)
- description = forms.CharField(widget=forms.Textarea)
+ name = forms.CharField(max_length=255, help_text="System name assigned by OES")
+ function = forms.CharField(widget=forms.Textarea)
organisation = forms.ModelChoiceField(queryset=Organisation.objects.all())
caf = forms.ModelChoiceField(queryset=CAF.objects.all())
@@ -30,26 +31,31 @@ class ApplicableSystemCreateFromCafForm(forms.Form):
super().__init__(*args, **kwargs)
caf = CAF.objects.get(pk=caf_id)
cancel_redirect = reverse("caf:detail", args=[caf_id])
- self.fields['caf'].queryset = CAF.objects.filter(pk=caf_id)
+ self.fields["caf"].queryset = CAF.objects.filter(pk=caf_id)
self.helper = FormHelper(self)
self.helper.layout = Layout(
Fieldset(
"",
Field("name", css_class="form-control-lg"),
- "description",
+ "function",
Hidden("caf", caf_id),
Hidden("organisation", org_id),
),
ButtonHolder(
Submit("submit", "Submit", css_class="btn-primary"),
- Button("cancel", "Cancel", onclick=f"location.href='{cancel_redirect}';", css_class="btn-danger")
- )
+ Button(
+ "cancel",
+ "Cancel",
+ onclick=f"location.href='{cancel_redirect}';",
+ css_class="btn-danger",
+ ),
+ ),
)
class ApplicableSystemCreateFromOrgForm(forms.Form):
name = forms.CharField(max_length=255)
- description = forms.CharField(widget=forms.Textarea)
+ function = forms.CharField(widget=forms.Textarea)
organisation = forms.ModelChoiceField(queryset=Organisation.objects.all())
caf = forms.ModelChoiceField(queryset=CAF.objects.all())
@@ -57,18 +63,25 @@ class ApplicableSystemCreateFromOrgForm(forms.Form):
super().__init__(*args, **kwargs)
cancel_redirect = reverse("organisations:detail", args=[slug])
# we need to create the choices we can use for the CAF dropdown in the form
- self.fields['caf'].queryset = CAF.objects.filter(pk__in=[caf.pk for caf in org_cafs])
+ self.fields["caf"].queryset = CAF.objects.filter(
+ pk__in=[caf.pk for caf in org_cafs]
+ )
self.helper = FormHelper(self)
self.helper.layout = Layout(
Fieldset(
"",
Field("name", css_class="form-control-lg"),
- "description",
+ "function",
Hidden("organisation", org_id),
"caf",
),
ButtonHolder(
Submit("submit", "Submit", css_class="btn-primary"),
- Button("cancel", "Cancel", onclick=f"location.href='{cancel_redirect}';", css_class="btn-danger")
- )
+ Button(
+ "cancel",
+ "Cancel",
+ onclick=f"location.href='{cancel_redirect}';",
+ css_class="btn-danger",
+ ),
+ ),
)