-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathforms.py
More file actions
105 lines (92 loc) · 2.82 KB
/
forms.py
File metadata and controls
105 lines (92 loc) · 2.82 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#-*- coding: UTF-8 -*-
#updated program
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Field
from crispy_forms.bootstrap import FormActions
error_messages = {
'required': 'Bu alan gereklidir.',
}
class MemberForm(forms.Form):
nickname = forms.CharField(
label = 'Nickname',
max_length = 100,
required = True,
error_messages=error_messages,
)
name = forms.CharField(
label = 'Ad soyad',
max_length = 100,
required = True,
error_messages=error_messages,
)
email = forms.EmailField(
label = 'E-posta',
required = True,
error_messages=error_messages,
)
email_visibility = forms.ChoiceField(
label = '',
choices = (
('visible', 'E-posta adresimin yayınlanmasında sakınca yoktur.'),
('invisible', 'E-posta adresimin yayınlanmasın.'),
),
widget = forms.RadioSelect,
initial = 'visible',
)
institution = forms.CharField(
label = 'Okuduğunuz/Çalıştığınız kurum',
required = False,
)
department = forms.CharField(
label = 'Okuduğunuz bölüm/Pozisyonunuz',
required = False,
)
irc = forms.CharField(
label = 'IRC nickname',
required = False,
)
twitter = forms.CharField(
label = 'Twitter kullanıcı adınız',
required = False,
)
github = forms.CharField(
label = 'Github kullanıcı adınız',
required = False,
)
teams = forms.MultipleChoiceField(
label = 'Yer almak istediğiniz ekip(ler)',
choices = (
('project', 'Proje ekibi'),
('translation', 'Çeviri ekibi'),
('event', 'Etkinlik ekibi'),
),
widget = forms.CheckboxSelectMultiple,
required = False,
)
description = forms.CharField(
label = 'Eklemek istedikleriniz',
widget = forms.Textarea(),
required = False,
)
helper = FormHelper()
helper.form_tag = False
helper.form_class = 'form-horizontal'
helper.label_class = 'col-md-2'
helper.field_class = 'col-md-8'
helper.layout = Layout(
Field('nickname', css_class='form-control', style='margin-bottom: 25px'),
Field('name', css_class='form-control', style='margin-bottom: 25px'),
Field('email', css_class='form-control', style='margin-bottom: 5px'),
Field('email_visibility', style='padding-left: 25px; margin-bottom: 25px'),
Field('institution', css_class='form-control', style='margin-bottom: 25px'),
Field('department', css_class='form-control', style='margin-bottom: 25px'),
Field('irc', css_class='form-control', style='margin-bottom: 25px'),
Field('twitter', css_class='form-control', style='margin-bottom: 25px'),
Field('github', css_class='form-control', style='margin-bottom: 25px'),
Field('teams', style='padding-left: 30px; margin-bottom: 25px'),
Field('description', rows='3', css_class='form-control', style='margin-bottom: 25px'),
FormActions(
Submit('send', 'Formu Gonder', css_class='btn-primary', style='margin-bottom: 25px'),
)
)