aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/forms.py
diff options
context:
space:
mode:
authorMR Lemon <matt@matthewlemon>2020-05-01 17:30:48 +0100
committerMR Lemon <matt@matthewlemon>2020-05-01 17:31:03 +0100
commit989b3bf9259b06ed3542d16a81712635ef492c33 (patch)
treef3f53e9000712568942e658dfbd889068bed2fd4 /ctrack/organisations/forms.py
parentdbe4555b17e2dd0d49b8c4879252692f75f8fe42 (diff)
started to put in an inlineformset!
Diffstat (limited to 'ctrack/organisations/forms.py')
-rw-r--r--ctrack/organisations/forms.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/ctrack/organisations/forms.py b/ctrack/organisations/forms.py
index d4baf64..8cf9983 100644
--- a/ctrack/organisations/forms.py
+++ b/ctrack/organisations/forms.py
@@ -47,17 +47,34 @@ class OrganisationCreateForm(forms.ModelForm):
class AddressCreateForm(forms.ModelForm):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.helper = FormHelper(self)
+ self.helper.layout = Layout(
+ Fieldset(
+ "type",
+ "line1",
+ "line2",
+ "line3",
+ "city",
+ "county",
+ "postcode",
+ "country",
+ "other_details"
+ )
+ )
+
class Meta:
model = Address
fields = ('type', 'line1', 'line2', 'line3', 'city', 'county', 'postcode',
'country', 'other_details')
- def __init__(self, *args, **kwargs):
- self.org = kwargs.pop("org")
- super().__init__(*args, **kwargs)
-
- def save(self):
- address = super().save(commit=False)
- address.organisation = self.org
- address.organisation.save()
- return address
+ # def __init__(self, *args, **kwargs):
+ # self.org = kwargs.pop("org")
+ # super().__init__(*args, **kwargs)
+ #
+ # def save(self):
+ # address = super().save(commit=False)
+ # address.organisation = self.org
+ # address.organisation.save()
+ # return address