blob: ee3bf211661ae0bc930ff219c3c5b15a30ce9101 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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")),
)
|