ojuso-map/apps/map/forms.py
2017-06-16 18:10:44 +02:00

26 lines
813 B
Python

from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from leaflet.forms.widgets import LeafletWidget
from .models import CaseStudy
class CaseStudyForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(CaseStudyForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'case-study-form'
self.helper.form_class = 'form-horizontal'
self.helper.form_method = 'post'
self.helper.form_action = 'submit'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-8'
self.helper.add_input(Submit('submit', 'Submit'))
class Meta:
model = CaseStudy
fields = '__all__'
widgets = {'location': LeafletWidget()}