aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/caf/forms.py')
-rw-r--r--ctrack/caf/forms.py26
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")),
+ )