diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-27 20:25:04 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-27 20:25:04 +0000 |
commit | dfc5ede55ee0bb70be9f5317324409d5f0eb763a (patch) | |
tree | d245e6fdfb5cfeda72a2e533988f0315fab47073 /ctrack/caf/forms.py | |
parent | d0ac61da601f46e383ea865b784d347229ac41dc (diff) |
added register and caf applications
Diffstat (limited to 'ctrack/caf/forms.py')
-rw-r--r-- | ctrack/caf/forms.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py new file mode 100644 index 0000000..ee3bf21 --- /dev/null +++ b/ctrack/caf/forms.py @@ -0,0 +1,26 @@ +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Button +from crispy_forms.layout import ButtonHolder +from crispy_forms.layout import Fieldset +from crispy_forms.layout import Layout +from crispy_forms.layout import Submit +from django import forms + +from ctrack.caf.models import CAF + + +class CAFForm(forms.ModelForm): + class Meta: + model = CAF + fields = ["owner", "essential_system"] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.helper = FormHelper(self) + self.helper.form_class = "form-group" + self.helper.form_method = "post" + self.helper.layout = Layout( + Fieldset("Create/Edit CAF", "owner", "essential_system"), + ButtonHolder(Submit("submit", "Submit"), Button("cancel", "Cancel")), + ) |