From f64b07b6badb9bda4abc7f20f2bff52f39d83b3f Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 15 Jan 2016 11:59:39 -0200 Subject: [PATCH] Fix Parlamentares when data base is empty --- parlamentares/views.py | 2 ++ templates/parlamentares/parlamentares_detail.html | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/parlamentares/views.py b/parlamentares/views.py index 077d91031..ab44f0e6c 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -157,6 +157,7 @@ class ParlamentaresView(GenericView): def get(self, request, *args, **kwargs): form = ParlamentaresListForm() + # import ipdb; ipdb.set_trace() if not Legislatura.objects.all(): mensagem = "Cadastre alguma Legislatura antes\ de cadastrar algum Parlamentar" @@ -414,6 +415,7 @@ class ParlamentaresCadastroView(FormMixin, GenericView): def get(self, request, *args, **kwargs): form = ParlamentaresForm() + pk = kwargs['pk'] return self.render_to_response({'form': form, 'legislatura_id': pk}) diff --git a/templates/parlamentares/parlamentares_detail.html b/templates/parlamentares/parlamentares_detail.html index af5028fcf..20b486ed1 100644 --- a/templates/parlamentares/parlamentares_detail.html +++ b/templates/parlamentares/parlamentares_detail.html @@ -2,8 +2,8 @@ {% load i18n %} {% block actions %} {% endblock actions %}