Commit 4784944b8ce9891ca7d7b35863dba3a96071e049
1 parent
0093f686
Exists in
master
and in
5 other branches
atualização na validação do cpf #371
Showing
3 changed files
with
53 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-15 23:54 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('app', '0001_initial'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AlterField( | ||
16 | + model_name='emailbackend', | ||
17 | + name='default_from_email', | ||
18 | + field=models.EmailField(max_length=254, verbose_name='Default from email'), | ||
19 | + ), | ||
20 | + ] |
core/forms.py
@@ -10,7 +10,7 @@ import re | @@ -10,7 +10,7 @@ import re | ||
10 | class RegisterUserForm(forms.ModelForm): | 10 | class RegisterUserForm(forms.ModelForm): |
11 | 11 | ||
12 | password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) | 12 | password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) |
13 | - password2 = forms.CharField(label = _('Password confirmation'), widget = forms.PasswordInput) | 13 | + password2 = forms.CharField(label = _('Confirm Password'), widget = forms.PasswordInput) |
14 | # birth_date = forms.DateField(widget=forms.SelectDateWidget()) | 14 | # birth_date = forms.DateField(widget=forms.SelectDateWidget()) |
15 | MIN_LENGTH = 8 | 15 | MIN_LENGTH = 8 |
16 | 16 | ||
@@ -36,6 +36,8 @@ class RegisterUserForm(forms.ModelForm): | @@ -36,6 +36,8 @@ class RegisterUserForm(forms.ModelForm): | ||
36 | 36 | ||
37 | def clean_cpf(self): | 37 | def clean_cpf(self): |
38 | cpf = self.cleaned_data['cpf'] | 38 | cpf = self.cleaned_data['cpf'] |
39 | + if (cpf == ""): | ||
40 | + return cpf | ||
39 | if User.objects.filter(cpf = cpf).exists(): | 41 | if User.objects.filter(cpf = cpf).exists(): |
40 | raise forms.ValidationError(_('There is already a registered User with this CPF')) | 42 | raise forms.ValidationError(_('There is already a registered User with this CPF')) |
41 | # if not self.validate_cpf(cpf): | 43 | # if not self.validate_cpf(cpf): |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-15 23:54 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('users', '0002_auto_20161115_1941'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AlterField( | ||
16 | + model_name='user', | ||
17 | + name='cpf', | ||
18 | + field=models.CharField(blank=True, max_length=15, null=True, verbose_name='CPF'), | ||
19 | + ), | ||
20 | + migrations.AlterField( | ||
21 | + model_name='user', | ||
22 | + name='image', | ||
23 | + field=models.ImageField(blank=True, null=True, upload_to='users/', verbose_name='Photo'), | ||
24 | + ), | ||
25 | + migrations.AlterField( | ||
26 | + model_name='user', | ||
27 | + name='institution', | ||
28 | + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Institution'), | ||
29 | + ), | ||
30 | + ] |