diff options
author | MR Lemon <matt@matthewlemon> | 2020-05-01 20:54:48 +0100 |
---|---|---|
committer | MR Lemon <matt@matthewlemon> | 2020-05-01 20:54:48 +0100 |
commit | fbe7fb2c4da9d990b5f8f77c30a23dd296fac15a (patch) | |
tree | 711abcfe81f25eec7b494fe276ff594c914fe408 /ctrack/organisations/forms.py | |
parent | 989b3bf9259b06ed3542d16a81712635ef492c33 (diff) |
some progress but fking slow...
Diffstat (limited to '')
-rw-r--r-- | ctrack/organisations/forms.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ctrack/organisations/forms.py b/ctrack/organisations/forms.py index 8cf9983..2609a6b 100644 --- a/ctrack/organisations/forms.py +++ b/ctrack/organisations/forms.py @@ -1,6 +1,7 @@ from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, Button, Field from django import forms +from django.forms import inlineformset_factory from django.urls import reverse from ctrack.organisations.models import Organisation, Address @@ -49,9 +50,11 @@ class OrganisationCreateForm(forms.ModelForm): class AddressCreateForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + cancel_redirect = reverse("organisations:list") self.helper = FormHelper(self) self.helper.layout = Layout( Fieldset( + "Add an address", "type", "line1", "line2", @@ -78,3 +81,7 @@ class AddressCreateForm(forms.ModelForm): # address.organisation = self.org # address.organisation.save() # return address + + +AddressInlineForm = inlineformset_factory(Organisation, Address, exclude=(), can_delete=False, + form=AddressCreateForm, extra=1) |