This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforms.py
54 lines (47 loc) · 2.2 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext
from crispy_forms.helper import FormHelper
from crispy_forms import layout, bootstrap
from crispy_forms.layout import Field
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
class ContactForm(forms.Form):
#from_email = forms.EmailField(required=True)
#subject = forms.CharField(required=True)
#message = forms.CharField(widget=forms.Textarea,required=True)
email_contact = forms.EmailField( label = "Write your email ", required = True)
subject = forms.CharField( label = "Write the Subject of the email ", max_length = 40, required = True)
message = forms.CharField( label = "Describe your request ", widget=forms.Textarea, required = True)
def __init__(self,*args, **kwargs):
super(ContactForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-5'
self.helper.field_class = 'col-lg-7'
self.helper.form_action=""
self.helper.form_method="POST"
self.helper.layout = layout.Layout(
layout.Div(
layout.HTML(u"""<div class="panel-heading"><h3 class="panel-title">Write your email and your request </h3></div>"""),
layout.Div(
layout.Div(
layout.Field('email_contact'),
css_class="col-md-10",
),
layout.Div(
layout.Field('subject'),
css_class="col-md-10",
),
layout.Div(
layout.Field('message'),
css_class="col-md-10",
),
layout.Div(
bootstrap.FormActions( layout.Reset(('Reset'),_('Reset')),
layout.Submit(('submit'),_('Submit'),style='margin-left: 80px')),
css_class="col-md-10"
),
css_class="row panel-body",
),
css_class = "panel panel-default"
),
)