|
@ -451,16 +451,14 @@ class ParlamentaresEditarView(FormMixin, GenericView): |
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
pk = kwargs['pk'] |
|
|
pk = kwargs['pk'] |
|
|
pid = kwargs['pid'] |
|
|
parlamentar = Parlamentar.objects.get(pk=pk) |
|
|
parlamentar = Parlamentar.objects.get(id=pid) |
|
|
|
|
|
form = ParlamentaresEditForm(instance=parlamentar) |
|
|
form = ParlamentaresEditForm(instance=parlamentar) |
|
|
return self.render_to_response( |
|
|
return self.render_to_response( |
|
|
{'form': form, 'legislatura_id': pk, 'parlamentar': parlamentar}) |
|
|
{'form': form, 'parlamentar': parlamentar}) |
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
def post(self, request, *args, **kwargs): |
|
|
pk = kwargs['pk'] |
|
|
pk = kwargs['pk'] |
|
|
pid = kwargs['pid'] |
|
|
parlamentar = Parlamentar.objects.get(pk=pk) |
|
|
parlamentar = Parlamentar.objects.get(id=pid) |
|
|
|
|
|
form = ParlamentaresEditForm(request.POST, instance=parlamentar) |
|
|
form = ParlamentaresEditForm(request.POST, instance=parlamentar) |
|
|
|
|
|
|
|
|
if form.is_valid(): |
|
|
if form.is_valid(): |
|
@ -486,8 +484,7 @@ class ParlamentaresEditarView(FormMixin, GenericView): |
|
|
|
|
|
|
|
|
return self.form_valid(form) |
|
|
return self.form_valid(form) |
|
|
else: |
|
|
else: |
|
|
return self.render_to_response( |
|
|
return self.render_to_response({'form': form}) |
|
|
{'form': form, 'legislatura_id': pk}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DependenteForm(ModelForm): |
|
|
class DependenteForm(ModelForm): |
|
|