forms.py 1.43 KB
Newer Older
Patrick Colmant's avatar
Patrick Colmant committed
1 2 3 4 5 6 7
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from django.core.urlresolvers import reverse
from django.conf import settings
from djangocms_text_ckeditor.fields import HTMLField
from django.utils.translation import ugettext_lazy as _
8 9 10
from django.forms.models import BaseModelFormSet

from repanier.models import OfferItem, OfferItemManager
Patrick Colmant's avatar
Patrick Colmant committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

class ContactForm(forms.Form):
    email = forms.EmailField(label='Your Email')
    subject = forms.CharField()
    message = forms.CharField(widget=forms.Textarea)

    def __init__(self, *args, **kwargs):
		super(ContactForm, self).__init__(*args, **kwargs)
		self.helper = FormHelper()
		self.helper.form_id = 'contact_form'
		self.helper.form_class = 'form-horizontal'
		self.helper.label_class = 'col-lg-2'
		self.helper.field_class = 'col-lg-10'
		self.helper.add_input(Submit('submit', 'Submit'))

class ContactFormAjax(forms.Form):
    email = forms.EmailField(label='Your Email')
    subject = forms.CharField()
    message = forms.CharField(widget=forms.Textarea)

    def __init__(self, *args, **kwargs):
		super(ContactFormAjax, self).__init__(*args, **kwargs)
		self.helper = FormHelper()
		self.helper.form_id = 'contact_form_ajax'
		self.helper.form_class = 'form-horizontal'
		self.helper.label_class = 'col-lg-2'
		self.helper.field_class = 'col-lg-10'
		self.helper.add_input(Submit('submit', 'Submit'))