From 6e8b47d35058e27308bba336b97859e60d5fcc25 Mon Sep 17 00:00:00 2001 From: Anna Sidwell Date: Wed, 28 Mar 2018 18:16:52 +1100 Subject: [PATCH] Add a submit button to express form (closes #39) --- apps/map/forms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/map/forms.py b/apps/map/forms.py index 17345ad..fbda5b0 100644 --- a/apps/map/forms.py +++ b/apps/map/forms.py @@ -2,7 +2,7 @@ from django.urls import reverse from django import forms from django.utils.translation import ugettext as _ from crispy_forms.helper import FormHelper -from crispy_forms.layout import Submit, Layout, HTML, Fieldset +from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div from crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions from leaflet.forms.widgets import LeafletWidget @@ -13,7 +13,7 @@ class BaseCaseStudyForm(forms.models.ModelForm): """Base form class for the CaseStudy model.""" def __init__(self, *args, **kwargs): super(BaseCaseStudyForm, self).__init__(*args, **kwargs) - self.helper = FormHelper() + self.helper = FormHelper(self) self.helper.form_id = 'case-study-form' self.helper.form_class = 'form-horizontal' self.helper.form_method = 'post' @@ -38,6 +38,7 @@ class ShortCaseStudyForm(BaseCaseStudyForm): def __init__(self, *args, **kwargs): super(ShortCaseStudyForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse('short-form') + self.helper.add_input(Submit('submit', _('Submit'), css_class='btn-success center-block')) class Meta(BaseCaseStudyForm.Meta): fields = [ @@ -66,7 +67,6 @@ class ShortCaseStudyForm(BaseCaseStudyForm): 'community_voices' ] - class LongCaseStudyForm(BaseCaseStudyForm): """Long version of the CaseStudy form.""" def __init__(self, *args, **kwargs):