-
Notifications
You must be signed in to change notification settings - Fork 302
Expand file tree
/
Copy pathforms.py
More file actions
54 lines (35 loc) · 1.27 KB
/
forms.py
File metadata and controls
54 lines (35 loc) · 1.27 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
from django import forms
from .choices import COMPANY_TYPES_CHOICES, REGION_CHOICES_2002_2015
from .validators import MDIDNOFieldValidator, MDLicensePlateValidator
class MDIDNOField(forms.CharField):
"""
A form field for the Moldavian company identification number (IDNO).
.. versionadded:: 2.1
"""
default_validators = [MDIDNOFieldValidator()]
def __init__(self, **kwargs):
kwargs['max_length'] = 13
super().__init__(**kwargs)
class MDLicensePlateField(forms.CharField):
"""
A form field for the Moldavian license plate number.
.. versionadded:: 2.1
"""
default_validators = [MDLicensePlateValidator()]
def __init__(self, **kwargs):
kwargs['max_length'] = 13
super().__init__(**kwargs)
class MDCompanyTypesSelect(forms.Select):
"""
A Select widget that uses a list of Moldavian company types as its choices.
.. versionadded:: 2.1
"""
def __init__(self, attrs=None):
super().__init__(attrs, choices=COMPANY_TYPES_CHOICES)
class MDRegionSelect(forms.Select):
"""
A Select widget that uses a list of Moldavian regions as its choices.
.. versionadded:: 2.1
"""
def __init__(self, attrs=None):
super().__init__(attrs, choices=REGION_CHOICES_2002_2015)