diff options
author | MR Lemon <matt@matthewlemon> | 2020-04-17 16:03:51 +0100 |
---|---|---|
committer | MR Lemon <matt@matthewlemon> | 2020-04-17 16:03:51 +0100 |
commit | 51149b561a44e5ecfbca90dfb9989985ccf2c122 (patch) | |
tree | fd39a5d1768ed79a9b3a3419dc63edf2522e5e59 /ctrack/caf/forms.py | |
parent | a4be1627b2705bba96d80204043876a3abec6a24 (diff) |
Adding a form for creating ApplicableSystem objects
Diffstat (limited to 'ctrack/caf/forms.py')
-rw-r--r-- | ctrack/caf/forms.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py index fac3049..5903a2c 100644 --- a/ctrack/caf/forms.py +++ b/ctrack/caf/forms.py @@ -18,3 +18,26 @@ from django.forms.models import ModelMultipleChoiceField CAFCreateInlineFormset = inlineformset_factory( CAF, ApplicableSystem, fields=("name", "organisation"), extra=2) + + +class ApplicableSystemCreateForm(forms.ModelForm): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.helper = FormHelper(self) + self.helper.layout = Layout( + Fieldset( + "Create a new System", + "name", + "description", + "organisation", + "caf", + ), + ButtonHolder( + Submit("submit", "Submit", css_class="btn-primary") + ) + ) + + class Meta: + model = ApplicableSystem + fields = ["name", "description", "organisation", "caf"] |