Commit dfe1998c20d5adf54dba8b0e94c94710b2733294
1 parent
0fb0a9e5
Exists in
master
and in
5 other branches
Deleting comments in validate cpf #14
Showing
1 changed file
with
1 additions
and
25 deletions
Show diff stats
core/forms.py
@@ -15,31 +15,7 @@ class RegisterUserForm(forms.ModelForm): | @@ -15,31 +15,7 @@ class RegisterUserForm(forms.ModelForm): | ||
15 | 15 | ||
16 | def validate_cpf(self, cpf): | 16 | def validate_cpf(self, cpf): |
17 | cpf = ''.join(re.findall('\d', str(cpf))) | 17 | cpf = ''.join(re.findall('\d', str(cpf))) |
18 | - # print(cpf) | ||
19 | - | ||
20 | - # if (not cpf) or (len(cpf) < 11): | ||
21 | - # return False | ||
22 | - | ||
23 | - # #Get only the first 9 digits and generate other 2 | ||
24 | - # _int = map(int, cpf) | ||
25 | - # integer = list(map(int, cpf)) | ||
26 | - # new = integer[:9] | ||
27 | - | ||
28 | - # while len(new) < 11: | ||
29 | - # r = sum([(len(new) + 1 - i)* v for i, v in enumerate(new)]) % 11 | ||
30 | - | ||
31 | - # if r > 1: | ||
32 | - # f = 11 - r | ||
33 | - # else: | ||
34 | - # f = 0 | ||
35 | - # new.append(f) | ||
36 | - | ||
37 | - # #if generated number is the same(original) the cpf is valid | ||
38 | - # new2 = list(new) | ||
39 | - # if new2 == _int: | ||
40 | - # return cpf | ||
41 | - # else: | ||
42 | - # return False | 18 | + |
43 | if cpfcnpj.validate(cpf): | 19 | if cpfcnpj.validate(cpf): |
44 | return True | 20 | return True |
45 | return False | 21 | return False |