aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack
diff options
context:
space:
mode:
authorMR Lemon <matt@matthewlemon>2020-05-05 15:32:55 +0100
committerMR Lemon <matt@matthewlemon>2020-05-05 15:32:55 +0100
commit6031ba0980c35b787552f3118368229a75b1e0b9 (patch)
treef950e8c673b125233d7d35af62ceee18b209423d /ctrack
parentf74421c9a8982a692f190b0f9b0d3338b6f32fa8 (diff)
got rid of the crispy forms helper from the addresses inlineformset - going to do it manually
Diffstat (limited to 'ctrack')
-rw-r--r--ctrack/organisations/forms.py14
-rw-r--r--ctrack/organisations/templates/organisations/org_create_formset.html4
-rw-r--r--ctrack/organisations/views.py3
3 files changed, 5 insertions, 16 deletions
diff --git a/ctrack/organisations/forms.py b/ctrack/organisations/forms.py
index 30a24c5..ec5c34e 100644
--- a/ctrack/organisations/forms.py
+++ b/ctrack/organisations/forms.py
@@ -46,16 +46,6 @@ class AddressCreateForm(forms.ModelForm):
AddressInlineFormSet = inlineformset_factory(Organisation, Address,
fields=("type", "line1", "line2", "line3", "city",
"county", "postcode", "country", "other_details"),
- form=AddressCreateForm)
+ form=AddressCreateForm,
+ extra=2)
-
-class OrganisationInlineFormSetHelper(FormHelper):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.form_method = "post"
- self.layout = Layout(
- "line1",
- "line2"
- )
- self.render_required_fields = True
- self.add_input(Submit("submit", "Save"))
diff --git a/ctrack/organisations/templates/organisations/org_create_formset.html b/ctrack/organisations/templates/organisations/org_create_formset.html
index 251e5da..67d308a 100644
--- a/ctrack/organisations/templates/organisations/org_create_formset.html
+++ b/ctrack/organisations/templates/organisations/org_create_formset.html
@@ -63,16 +63,16 @@
{{ form.comments }}
<small class="form-text text-muted">{{ form.comments.help_text }}</small>
</div>
-
</div>
</div>
<h5>Add address:</h5>
<div class="row">
<div class="col-md-8">
- {% crispy addresses helper %}
+ {{ addresses }}
</div>
</div>
{# This is the address inlineformset#}
+ <input type="submit" value="Submit">
</form>
</div>
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 6578bdc..427d385 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -6,7 +6,7 @@ from django.db import transaction
from django.urls import reverse_lazy
from django.views.generic import DetailView, ListView, CreateView
-from .forms import OrganisationCreateForm, AddressInlineFormSet, OrganisationInlineFormSetHelper
+from .forms import OrganisationCreateForm, AddressInlineFormSet
from .models import Organisation
@@ -21,7 +21,6 @@ class OrganisationCreate(CreateView):
context["addresses"] = AddressInlineFormSet(self.request.POST)
else:
context["addresses"] = AddressInlineFormSet()
- context["helper"] = OrganisationInlineFormSetHelper()
return context
def form_valid(self, form):