diff options
author | MR Lemon <matt@matthewlemon> | 2020-05-01 17:30:48 +0100 |
---|---|---|
committer | MR Lemon <matt@matthewlemon> | 2020-05-01 17:31:03 +0100 |
commit | 989b3bf9259b06ed3542d16a81712635ef492c33 (patch) | |
tree | f3f53e9000712568942e658dfbd889068bed2fd4 /ctrack/organisations/forms.py | |
parent | dbe4555b17e2dd0d49b8c4879252692f75f8fe42 (diff) |
started to put in an inlineformset!
Diffstat (limited to 'ctrack/organisations/forms.py')
-rw-r--r-- | ctrack/organisations/forms.py | 35 |
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 |