Skip to content

Commit

Permalink
fix(vote): reload city when state is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Aug 29, 2024
1 parent e7c5e74 commit f18ca12
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/org_eleicoes/votepeloclima/candidature/filters/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..choices import Gender, Color
from ..fields import CepField, ButtonCheckboxSelectMultiple, ButtonRadioSelect
from ..forms import ProposeForm
from ..locations_utils import get_ufs
from ..locations_utils import get_ufs, get_choices
from ..models import Candidature


Expand Down Expand Up @@ -56,6 +56,14 @@ class Meta:

class Media:
js = ["https://code.jquery.com/jquery-3.5.1.min.js"]


def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

state = self.data.get("state")
if state:
self.fields["city"].choices = [("", "Selecione")] + get_choices(state)


class FilterFormSidebar(RemoveRequiredMixin, forms.ModelForm):
Expand Down

0 comments on commit f18ca12

Please sign in to comment.