Commit 2aed926766a6743e2814b77d6a201b86e018d8e9
1 parent
f5a1079b
Exists in
master
and in
5 other branches
Validate cpf in form
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
core/forms.py
@@ -4,8 +4,8 @@ from users.models import User | @@ -4,8 +4,8 @@ from users.models import User | ||
4 | 4 | ||
5 | class RegisterUserForm(forms.ModelForm): | 5 | class RegisterUserForm(forms.ModelForm): |
6 | 6 | ||
7 | - password = forms.CharField(label='Senha', widget=forms.PasswordInput) | ||
8 | - password2 = forms.CharField(label = 'Confirmacao de Senha', widget = forms.PasswordInput) | 7 | + password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) |
8 | + password2 = forms.CharField(label = _('Password confirmation'), widget = forms.PasswordInput) | ||
9 | # birth_date = forms.DateField(widget=forms.SelectDateWidget()) | 9 | # birth_date = forms.DateField(widget=forms.SelectDateWidget()) |
10 | MIN_LENGTH = 8 | 10 | MIN_LENGTH = 8 |
11 | 11 |
users/forms.py
@@ -5,6 +5,7 @@ from django import forms | @@ -5,6 +5,7 @@ from django import forms | ||
5 | from django.utils.translation import ugettext_lazy as _ | 5 | from django.utils.translation import ugettext_lazy as _ |
6 | from rolepermissions.shortcuts import assign_role | 6 | from rolepermissions.shortcuts import assign_role |
7 | from django.contrib.auth.forms import UserCreationForm | 7 | from django.contrib.auth.forms import UserCreationForm |
8 | +from core.forms import RegisterUserForm | ||
8 | from .models import User | 9 | from .models import User |
9 | 10 | ||
10 | 11 | ||
@@ -25,7 +26,7 @@ class ProfileForm(forms.ModelForm): | @@ -25,7 +26,7 @@ class ProfileForm(forms.ModelForm): | ||
25 | 'password':forms.PasswordInput | 26 | 'password':forms.PasswordInput |
26 | } | 27 | } |
27 | 28 | ||
28 | -class UserForm(UserCreationForm): | 29 | +class UserForm(RegisterUserForm): |
29 | def save(self, commit=True): | 30 | def save(self, commit=True): |
30 | super(UserForm, self).save() | 31 | super(UserForm, self).save() |
31 | 32 |