diff --git a/app/org_eleicoes/votepeloclima/candidature/forms/filters.py b/app/org_eleicoes/votepeloclima/candidature/forms/filters.py index 28f49aa7..4d1fec4d 100644 --- a/app/org_eleicoes/votepeloclima/candidature/forms/filters.py +++ b/app/org_eleicoes/votepeloclima/candidature/forms/filters.py @@ -6,7 +6,7 @@ # from django_select2.forms import Select2Widget from ..layout import NoCrispyField -from ..choices import Gender, Color +from ..choices import Gender, Color, Sexuality from ..fields import CepField, ButtonCheckboxSelectMultiple, ButtonRadioSelect from ..locations_utils import get_ufs, get_choices from ..models import Candidature @@ -80,12 +80,15 @@ class FilterFormSidebar(RemoveRequiredMixin, forms.ModelForm): label="Gênero", choices=Gender.choices[1:], widget=ButtonCheckboxSelectMultiple ) color = forms.MultipleChoiceField( - label="Raça", choices=Color.choices[1:], widget=ButtonCheckboxSelectMultiple + label="Cor ou raça", choices=Color.choices[1:], widget=ButtonCheckboxSelectMultiple + ) + sexuality = forms.MultipleChoiceField( + label="Sexualidade", choices=Sexuality.choices[1:], widget=ButtonCheckboxSelectMultiple ) class Meta: model = Candidature - fields = ["proposes", "mandate_type", "gender", "color"] + fields = ["proposes", "mandate_type", "gender", "color", "sexuality"] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -97,6 +100,7 @@ def __init__(self, *args, **kwargs): NoCrispyField("mandate_type"), NoCrispyField("gender"), NoCrispyField("color"), + NoCrispyField("sexuality"), ) def get_proposes_choices(self): diff --git a/app/org_eleicoes/votepeloclima/candidature/migrations/0022_alter_candidature_ballot_name_and_more.py b/app/org_eleicoes/votepeloclima/candidature/migrations/0022_alter_candidature_ballot_name_and_more.py new file mode 100644 index 00000000..15b0a731 --- /dev/null +++ b/app/org_eleicoes/votepeloclima/candidature/migrations/0022_alter_candidature_ballot_name_and_more.py @@ -0,0 +1,68 @@ +# Generated by Django 4.2 on 2024-09-11 18:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('candidature', '0021_alter_candidature_political_party'), + ] + + operations = [ + migrations.AlterField( + model_name='candidature', + name='ballot_name', + field=models.CharField(max_length=100, verbose_name='Nome na urna'), + ), + migrations.AlterField( + model_name='candidature', + name='birth_date', + field=models.DateField(verbose_name='Data de nascimento'), + ), + migrations.AlterField( + model_name='candidature', + name='color', + field=models.CharField(max_length=30, verbose_name='Cor ou raça'), + ), + migrations.AlterField( + model_name='candidature', + name='deputy_mayor_political_party', + field=models.CharField(blank=True, max_length=60, null=True, verbose_name='Partido do vice-prefeito'), + ), + migrations.AlterField( + model_name='candidature', + name='intended_position', + field=models.CharField(choices=[('', 'Selecione uma opção'), ('prefeitura', 'Prefeito/a'), ('vereacao', 'Vereador/a')], max_length=50, verbose_name='Cargo pretendido'), + ), + migrations.AlterField( + model_name='candidature', + name='is_collective_mandate', + field=models.BooleanField(blank=True, default=False, verbose_name='Mandato coletivo'), + ), + migrations.AlterField( + model_name='candidature', + name='number_id', + field=models.PositiveIntegerField(verbose_name='Número na urna'), + ), + migrations.AlterField( + model_name='candidature', + name='political_party', + field=models.CharField(choices=[('', 'Selecione o partido'), ('agir', 'Agir'), ('avante', 'Avante'), ('cidadania', 'Cidadania'), ('dc', 'DC'), ('mdb', 'MDB'), ('mobiliza', 'Mobiliza'), ('novo', 'Novo'), ('patriota', 'Patriota'), ('pcb', 'PCB'), ('pcdob', 'PCdoB'), ('pco', 'PCO'), ('pdt', 'PDT'), ('pl', 'PL'), ('pmb', 'PMB'), ('pmn', 'PMN'), ('pode', 'PODE'), ('pp', 'PP'), ('prd', 'PRD'), ('pros', 'PROS'), ('prtb', 'PRTB'), ('psb', 'PSB'), ('psc', 'PSC'), ('psd', 'PSD'), ('psdb', 'PSDB'), ('psol', 'PSOL'), ('pstu', 'PSTU'), ('pt', 'PT'), ('ptb', 'PTB'), ('ptc', 'PTC'), ('pv', 'PV'), ('rede', 'Rede'), ('republicanos', 'Republicanos'), ('solidariedade', 'Solidariedade'), ('união', 'União'), ('up', 'UP')], max_length=60, verbose_name='Partido político'), + ), + migrations.AlterField( + model_name='candidature', + name='sexuality', + field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Sexualidade'), + ), + migrations.AlterField( + model_name='candidature', + name='short_description', + field=models.TextField(verbose_name='Descrição curta'), + ), + migrations.AlterField( + model_name='candidature', + name='social_media', + field=models.JSONField(blank=True, default=list, null=True, verbose_name='Redes sociais'), + ), + ] diff --git a/app/org_eleicoes/votepeloclima/candidature/models.py b/app/org_eleicoes/votepeloclima/candidature/models.py index aa5916ad..6c60ae93 100644 --- a/app/org_eleicoes/votepeloclima/candidature/models.py +++ b/app/org_eleicoes/votepeloclima/candidature/models.py @@ -13,27 +13,27 @@ class Candidature(models.Model): legal_name = models.CharField(max_length=150, verbose_name="Nome") - ballot_name = models.CharField(max_length=100, verbose_name="Nome na Urna") - birth_date = models.DateField(verbose_name="Data de Nascimento") + ballot_name = models.CharField(max_length=100, verbose_name="Nome na urna") + birth_date = models.DateField(verbose_name="Data de nascimento") email = models.EmailField(verbose_name="E-mail") cpf = models.CharField(max_length=30, verbose_name="CPF") - number_id = models.PositiveIntegerField(verbose_name="Número na Urna") - intended_position = models.CharField(max_length=50, choices=IntendedPosition.choices, verbose_name="Cargo Pretendido") + number_id = models.PositiveIntegerField(verbose_name="Número na urna") + intended_position = models.CharField(max_length=50, choices=IntendedPosition.choices, verbose_name="Cargo pretendido") deputy_mayor = models.CharField(max_length=140, blank=True, null=True, verbose_name="Vice-prefeito") - deputy_mayor_political_party = models.CharField(max_length=60, blank=True, null=True, verbose_name="Partido do Vice-prefeito") + deputy_mayor_political_party = models.CharField(max_length=60, blank=True, null=True, verbose_name="Partido do vice-prefeito") state = models.CharField(max_length=10, verbose_name="Estado") city = models.CharField(max_length=60, verbose_name="Cidade") - is_collective_mandate = models.BooleanField(default=False, blank=True, verbose_name="Mandato Coletivo") - political_party = models.CharField(max_length=60, choices=PoliticalParty.choices, verbose_name="Partido Político") + is_collective_mandate = models.BooleanField(default=False, blank=True, verbose_name="Mandato coletivo") + political_party = models.CharField(max_length=60, choices=PoliticalParty.choices, verbose_name="Partido político") video = models.FileField(upload_to="candidatures/videos/", null=True, blank=True, verbose_name="Vídeo") photo = models.FileField(upload_to="candidatures/photos/", null=True, blank=True, verbose_name="Foto") gender = models.CharField(max_length=30, verbose_name="Gênero") - color = models.CharField(max_length=30, verbose_name="Raça") - sexuality = models.CharField(max_length=30, null=True, blank=True, choices=Sexuality.choices, verbose_name="Sexualidade") - social_media = models.JSONField(blank=True, null=True, default=list, verbose_name="Redes Sociais") + color = models.CharField(max_length=30, verbose_name="Cor ou raça") + sexuality = models.CharField(max_length=30, null=True, blank=True, verbose_name="Sexualidade") + social_media = models.JSONField(blank=True, null=True, default=list, verbose_name="Redes sociais") education = models.CharField(max_length=80, null=True, blank=True, choices=Education.choices, verbose_name="Educação") employment = models.CharField(max_length=150, null=True, blank=True, verbose_name="Ocupação") - short_description = models.TextField(verbose_name="Descrição Curta") + short_description = models.TextField(verbose_name="Descrição curta") milestones = models.JSONField(blank=True, null=True, default=list, verbose_name="Marcos") proposes = models.JSONField(blank=True, verbose_name="Propostas") appointments = models.JSONField(blank=True, verbose_name="Compromissos") @@ -73,6 +73,10 @@ def get_color_display(self): @property def get_gender_display(self): return dict(Gender.choices).get(self.gender) + + @property + def get_sexuality_display(self): + return dict(Sexuality.choices).get(self.sexuality) @property def get_proposes_display(self): diff --git a/app/org_eleicoes/votepeloclima/candidature/templates/candidature/candidate_profile.html b/app/org_eleicoes/votepeloclima/candidature/templates/candidature/candidate_profile.html index 7352b1f6..8120c685 100644 --- a/app/org_eleicoes/votepeloclima/candidature/templates/candidature/candidate_profile.html +++ b/app/org_eleicoes/votepeloclima/candidature/templates/candidature/candidate_profile.html @@ -51,7 +51,7 @@
Data de Nascimento: {{ candidature.birth_date }}
-Raça: {{ candidature.get_color_display }}
+Cor ou raça: {{ candidature.get_color_display }}
Gênero: {{ candidature.get_gender_display }}
{{ candidature.get_city_display }} - {{ candidature.get_state_display }}