forked from pythonprobr/pythonpro-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
21 lines (16 loc) · 716 Bytes
/
forms.py
File metadata and controls
21 lines (16 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from django import forms
class NameEmailForm(forms.Form):
name = forms.CharField(label='', widget=forms.TextInput(attrs={'placeholder': 'Insira seu Nome'}))
email = forms.EmailField(label='', widget=forms.TextInput(attrs={'placeholder': 'Insira seu Email'}))
class NameEmailPhoneForm(NameEmailForm):
phone = forms.CharField(
label='',
widget=forms.TextInput(attrs={'placeholder': 'Insira seu WhatsApp (não se esqueça do DDD)'})
)
def clean_phone(self):
phone = self.cleaned_data['phone']
phone = phone.replace('(', '')
phone = phone.replace(')', '')
phone = phone.replace(' ', '')
phone = phone.replace('-', '')
return phone