diff --git a/parlamentares/urls.py b/parlamentares/urls.py index f8da1d46f..a9180ddfc 100644 --- a/parlamentares/urls.py +++ b/parlamentares/urls.py @@ -54,7 +54,7 @@ urlpatterns = [ MandatoEditView.as_view(), name='parlamentares_mandato_edit'), - url(r'^parlamentares/(?P\d+)/(?P\d+)/editar$', + url(r'^parlamentares/(?P\d+)/editar$', ParlamentaresEditarView.as_view(), name='parlamentares_editar'), url(r'^mesa-diretora/$', diff --git a/parlamentares/views.py b/parlamentares/views.py index 51e3051e6..e301c04c5 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -447,16 +447,14 @@ class ParlamentaresEditarView(FormMixin, GenericView): def get(self, request, *args, **kwargs): pk = kwargs['pk'] - pid = kwargs['pid'] - parlamentar = Parlamentar.objects.get(id=pid) + parlamentar = Parlamentar.objects.get(pk=pk) form = ParlamentaresEditForm(instance=parlamentar) return self.render_to_response( - {'form': form, 'legislatura_id': pk, 'parlamentar': parlamentar}) + {'form': form, 'parlamentar': parlamentar}) def post(self, request, *args, **kwargs): pk = kwargs['pk'] - pid = kwargs['pid'] - parlamentar = Parlamentar.objects.get(id=pid) + parlamentar = Parlamentar.objects.get(pk=pk) form = ParlamentaresEditForm(request.POST, instance=parlamentar) if form.is_valid(): @@ -482,8 +480,7 @@ class ParlamentaresEditarView(FormMixin, GenericView): return self.form_valid(form) else: - return self.render_to_response( - {'form': form, 'legislatura_id': pk}) + return self.render_to_response({'form': form}) class DependenteForm(ModelForm): diff --git a/templates/parlamentares/parlamentares_detail.html b/templates/parlamentares/parlamentares_detail.html index 5d35ff5c7..705eb03d9 100644 --- a/templates/parlamentares/parlamentares_detail.html +++ b/templates/parlamentares/parlamentares_detail.html @@ -10,7 +10,7 @@ {% block sections_nav %}