From 040d09bbd78c027092554aeab358ff31c3ba8c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 2 Sep 2022 13:33:10 -0300 Subject: [PATCH] BUG de acesso ao banco em migrate total --- sigi/apps/parlamentares/forms.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sigi/apps/parlamentares/forms.py b/sigi/apps/parlamentares/forms.py index 907b9ab..de8271d 100644 --- a/sigi/apps/parlamentares/forms.py +++ b/sigi/apps/parlamentares/forms.py @@ -9,9 +9,6 @@ class ImportForm(forms.Form): ("iso8859-1", _("LATIN 1 (iso-8859-1)")), ("utf-8", _("UTF-8")), ) - UF_CHOICES = [ - ("BR", _("Todo o Brasil")), - ] + [(uf.sigla, uf.nome) for uf in UnidadeFederativa.objects.all()] TIPO_CHOICES = [ ("V", _("Vereador")), ("D", _("Deputado Estadual")), @@ -35,6 +32,10 @@ class ImportForm(forms.Form): suplentes = forms.BooleanField( label=_("Importar suplentes"), required=False ) - uf_importar = forms.ChoiceField( - label=_("Unidade Federativa"), choices=UF_CHOICES - ) + uf_importar = forms.ChoiceField(label=_("Unidade Federativa"), choices=[]) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["uf_importar"].choices = [ + ("BR", _("Todo o Brasil")), + ] + [(uf.sigla, uf.nome) for uf in UnidadeFederativa.objects.all()]