Commit 8d39cac8e035fc2028489a8aba13c04626728ac2
1 parent
0c99ae7f
Exists in
master
and in
5 other branches
cpf blank is valid #227
Showing
1 changed file
with
5 additions
and
5 deletions
Show diff stats
core/forms.py
... | ... | @@ -16,7 +16,7 @@ class RegisterUserForm(forms.ModelForm): |
16 | 16 | |
17 | 17 | def validate_cpf(self, cpf): |
18 | 18 | cpf = ''.join(re.findall('\d', str(cpf))) |
19 | - | |
19 | + | |
20 | 20 | if cpfcnpj.validate(cpf): |
21 | 21 | return True |
22 | 22 | return False |
... | ... | @@ -38,8 +38,8 @@ class RegisterUserForm(forms.ModelForm): |
38 | 38 | cpf = self.cleaned_data['cpf'] |
39 | 39 | if User.objects.filter(cpf = cpf).exists(): |
40 | 40 | raise forms.ValidationError(_('There is already a registeres User with this CPF')) |
41 | - if not self.validate_cpf(cpf): | |
42 | - raise forms.ValidationError(_('Please enter a valid CPF')) | |
41 | + # if not self.validate_cpf(cpf): | |
42 | + # raise forms.ValidationError(_('Please enter a valid CPF')) | |
43 | 43 | return cpf |
44 | 44 | |
45 | 45 | def clean_password(self): |
... | ... | @@ -68,12 +68,12 @@ class RegisterUserForm(forms.ModelForm): |
68 | 68 | def save(self, commit=True): |
69 | 69 | super(RegisterUserForm, self).save(commit=False) |
70 | 70 | self.instance.set_password(self.cleaned_data['password']) |
71 | - | |
71 | + | |
72 | 72 | self.instance.save() |
73 | 73 | return self.instance |
74 | 74 | |
75 | 75 | class Meta: |
76 | 76 | model = User |
77 | 77 | # exclude = ['is_staff', 'is_active'] |
78 | - fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image', 'titration', | |
78 | + fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image', 'titration', | |
79 | 79 | 'year_titration', 'institution', 'curriculum',] |
80 | 80 | \ No newline at end of file | ... | ... |