-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vote): Create constraint unique_cpf_per_year on model candidature
- Loading branch information
1 parent
ad0ec16
commit ecad1eb
Showing
3 changed files
with
42 additions
and
26 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
app/org_eleicoes/votepeloclima/candidature/migrations/0023_electionresult.py
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...eloclima/candidature/migrations/0023_electionresult_candidature_election_year_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,35 @@ | ||
# Generated by Django 4.2 on 2024-10-08 14:40 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('candidature', '0022_alter_candidature_ballot_name_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ElectionResult', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('status', models.CharField(choices=[('eleita', 'Eleita/o'), ('segundo_turno', 'Segundo Turno'), ('nao_eleito', 'Não Eleita/o')], max_length=20, verbose_name='Status da eleição')), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='candidature', | ||
name='election_year', | ||
field=models.PositiveIntegerField(default=2024, verbose_name='Ano da eleição'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='candidature', | ||
constraint=models.UniqueConstraint(fields=('cpf', 'election_year'), name='unique_cpf_per_year'), | ||
), | ||
migrations.AddField( | ||
model_name='electionresult', | ||
name='candidature', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='election_results', to='candidature.candidature'), | ||
), | ||
] |
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