From da76c151f8584c1f98afc0c2702407af817b3de3 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 8 Feb 2017 11:48:14 -0200 Subject: [PATCH] Fix #767 --- sapl/base/views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sapl/base/views.py b/sapl/base/views.py index 9d50c7176..96b989479 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -386,6 +386,18 @@ class CasaLegislativaCrud(CrudAux): list_field_names = ['codigo', 'nome', 'sigla'] form_class = CasaLegislativaForm + class ListView(CrudAux.ListView): + + def get(self, request, *args, **kwargs): + casa = get_casalegislativa() + if casa: + return HttpResponseRedirect( + reverse('sapl.base:casalegislativa_detail', + kwargs={'pk': casa.pk})) + else: + return HttpResponseRedirect( + reverse('sapl.base:casalegislativa_create')) + class DetailView(CrudAux.DetailView): def get(self, request, *args, **kwargs):