Skip to content

Commit

Permalink
feat(vote): display ufs on public pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomario committed Oct 1, 2024
1 parent 400568d commit de1e5c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/org_eleicoes/votepeloclima/candidature/forms/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ..layout import NoCrispyField
from ..choices import Gender, Color, Sexuality
from ..fields import CepField, ButtonCheckboxSelectMultiple, ButtonRadioSelect
from ..locations_utils import get_ufs, get_choices
from ..locations_utils import get_states, get_choices
from ..models import Candidature

from .register import ProposeForm
Expand Down Expand Up @@ -36,7 +36,7 @@ class FilterFormHeader(RemoveRequiredMixin, forms.ModelForm):
field="state",
label="Estado",
placeholder="Todos os estados",
choices=[("", "Todos os estados")] + lazy(get_ufs, list)(),
choices=[("", "Todos os estados")] + lazy(get_states, list)(),
)
city = CepField(
field="city", parent="state", label="Município", placeholder="Selecione"
Expand Down
4 changes: 2 additions & 2 deletions app/org_eleicoes/votepeloclima/candidature/forms/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from crispy_forms.layout import Layout, Div, Field, HTML
from bootstrap_datepicker_plus.widgets import DatePickerInput

from ..locations_utils import get_ufs, get_choices
from ..locations_utils import get_states, get_choices
from ..choices import (
PoliticalParty,
IntendedPosition,
Expand Down Expand Up @@ -192,7 +192,7 @@ class ApplicationForm(EntangledModelFormMixin, DisabledMixin, forms.ModelForm):
field="state",
label="Estado",
placeholder="Selecione",
choices=[("", "Selecione")] + lazy(get_ufs, list)(),
choices=[("", "Selecione")] + lazy(get_states, list)(),
help_text="Estado onde você está concorrendo",
)
city = CepField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def get_states(column_label="nome_uf") -> List[Tuple[str, str]]:
return sorted([(state['uf'], state[column_label]) for state in states], key=lambda x: x[1])

def get_ufs() -> List[Tuple[str, str]]:
return get_states(column_label="nome_uf")
return get_states(column_label="sigla_uf")

def get_choices(uf: str) -> List[Tuple[str, str]]:
choices = PlacesIBGE.objects.filter(uf=uf).values('codigo_municipio_completo', 'nome_municipio').distinct()
Expand Down
4 changes: 2 additions & 2 deletions app/org_eleicoes/votepeloclima/candidature/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.utils.html import mark_safe

from .choices import CandidatureFlowStatus, IntendedPosition, PoliticalParty, Gender, Color, Sexuality, Education
from .locations_utils import get_choices, get_states
from .locations_utils import get_choices, get_ufs


# Acompanhar validação da candidatura
Expand Down Expand Up @@ -58,7 +58,7 @@ def status(self):

@property
def get_state_display(self):
states = dict(get_states())
states = dict(get_ufs())
return states.get(self.state, "")

@property
Expand Down

0 comments on commit de1e5c3

Please sign in to comment.