Add a submit button to express form (closes #39)
This commit is contained in:
parent
03cc89346f
commit
6e8b47d350
@ -2,7 +2,7 @@ from django.urls import reverse
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from crispy_forms.helper import FormHelper
|
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 crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions
|
||||||
from leaflet.forms.widgets import LeafletWidget
|
from leaflet.forms.widgets import LeafletWidget
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ class BaseCaseStudyForm(forms.models.ModelForm):
|
|||||||
"""Base form class for the CaseStudy model."""
|
"""Base form class for the CaseStudy model."""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(BaseCaseStudyForm, self).__init__(*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_id = 'case-study-form'
|
||||||
self.helper.form_class = 'form-horizontal'
|
self.helper.form_class = 'form-horizontal'
|
||||||
self.helper.form_method = 'post'
|
self.helper.form_method = 'post'
|
||||||
@ -38,6 +38,7 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ShortCaseStudyForm, self).__init__(*args, **kwargs)
|
super(ShortCaseStudyForm, self).__init__(*args, **kwargs)
|
||||||
self.helper.form_action = reverse('short-form')
|
self.helper.form_action = reverse('short-form')
|
||||||
|
self.helper.add_input(Submit('submit', _('Submit'), css_class='btn-success center-block'))
|
||||||
|
|
||||||
class Meta(BaseCaseStudyForm.Meta):
|
class Meta(BaseCaseStudyForm.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
@ -66,7 +67,6 @@ class ShortCaseStudyForm(BaseCaseStudyForm):
|
|||||||
'community_voices'
|
'community_voices'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class LongCaseStudyForm(BaseCaseStudyForm):
|
class LongCaseStudyForm(BaseCaseStudyForm):
|
||||||
"""Long version of the CaseStudy form."""
|
"""Long version of the CaseStudy form."""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user