-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b55a8f5
commit a274b68
Showing
6 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...subscriptions/migrations/0004_alter_subscription_cpf_alter_subscription_email_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 5.0.3 on 2024-05-30 18:36 | ||
|
||
import eventex.subscriptions.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("subscriptions", "0003_alter_subscription_paid"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="subscription", | ||
name="cpf", | ||
field=models.CharField( | ||
max_length=11, | ||
validators=[eventex.subscriptions.validators.validate_cpf], | ||
verbose_name="CPF", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="subscription", | ||
name="email", | ||
field=models.EmailField(blank=True, max_length=254, verbose_name="e-mail"), | ||
), | ||
migrations.AlterField( | ||
model_name="subscription", | ||
name="phone", | ||
field=models.CharField(blank=True, max_length=20, verbose_name="telefone"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
def validate_cpf(value): | ||
if not value.isdigit(): | ||
raise ValidationError('CPF deve conter apenas números.', 'digits') | ||
if len(value) != 11: | ||
raise ValidationError('CPF deve ter 11 números.', 'length') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters