|
@ -183,7 +183,7 @@ class ProposicaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): |
|
|
class PesquisarParlamentarView(FilterView): |
|
|
class PesquisarParlamentarView(FilterView): |
|
|
model = Parlamentar |
|
|
model = Parlamentar |
|
|
filterset_class = ParlamentarFilterSet |
|
|
filterset_class = ParlamentarFilterSet |
|
|
paginate_by = 10 |
|
|
paginate_by = 20 |
|
|
|
|
|
|
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
super(PesquisarParlamentarView, |
|
|
super(PesquisarParlamentarView, |
|
@ -222,13 +222,17 @@ class PesquisarParlamentarView(FilterView): |
|
|
if data: |
|
|
if data: |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
if url.startswith("&page"): |
|
|
if url.startswith("&page"): |
|
|
ponto_comeco = url.find('nome_parlamentar=') - 1 |
|
|
url = '' |
|
|
url = url[ponto_comeco:] |
|
|
|
|
|
|
|
|
if 'nome_parlamentar' in self.request.META['QUERY_STRING'] or\ |
|
|
|
|
|
'page' in self.request.META['QUERY_STRING']: resultados = self.object_list |
|
|
|
|
|
else: |
|
|
|
|
|
resultados = [] |
|
|
|
|
|
|
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
object_list=self.object_list, |
|
|
object_list=resultados, |
|
|
filter_url=url, |
|
|
filter_url=url, |
|
|
numero_res=len(self.object_list) |
|
|
numero_res=len(resultados) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
context['show_results'] = show_results_filter_set( |
|
|
context['show_results'] = show_results_filter_set( |
|
@ -240,7 +244,7 @@ class PesquisarParlamentarView(FilterView): |
|
|
class PesquisarColigacaoView(FilterView): |
|
|
class PesquisarColigacaoView(FilterView): |
|
|
model = Coligacao |
|
|
model = Coligacao |
|
|
filterset_class = ColigacaoFilterSet |
|
|
filterset_class = ColigacaoFilterSet |
|
|
paginate_by = 10 |
|
|
paginate_by = 20 |
|
|
|
|
|
|
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
super(PesquisarColigacaoView, self).get_filterset_kwargs(filterset_class) |
|
|
super(PesquisarColigacaoView, self).get_filterset_kwargs(filterset_class) |
|
@ -273,13 +277,18 @@ class PesquisarColigacaoView(FilterView): |
|
|
if data: |
|
|
if data: |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
if url.startswith("&page"): |
|
|
if url.startswith("&page"): |
|
|
ponto_comeco = url.find('nome=') - 1 |
|
|
url = '' |
|
|
url = url[ponto_comeco:] |
|
|
|
|
|
|
|
|
if 'nome' in self.request.META['QUERY_STRING'] or\ |
|
|
|
|
|
'page' in self.request.META['QUERY_STRING']: resultados = self.object_list |
|
|
|
|
|
else: |
|
|
|
|
|
resultados = [] |
|
|
|
|
|
|
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
object_list=self.object_list, |
|
|
object_list=resultados, |
|
|
filter_url=url, |
|
|
filter_url=url, |
|
|
numero_res=len(self.object_list)) |
|
|
numero_res=len(resultados) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
context['show_results'] = show_results_filter_set( |
|
|
context['show_results'] = show_results_filter_set( |
|
|
self.request.GET.copy()) |
|
|
self.request.GET.copy()) |
|
@ -290,7 +299,7 @@ class PesquisarColigacaoView(FilterView): |
|
|
class PesquisarPartidoView(FilterView): |
|
|
class PesquisarPartidoView(FilterView): |
|
|
model = Partido |
|
|
model = Partido |
|
|
filterset_class = PartidoFilterSet |
|
|
filterset_class = PartidoFilterSet |
|
|
paginate_by = 10 |
|
|
paginate_by = 20 |
|
|
|
|
|
|
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
def get_filterset_kwargs(self, filterset_class): |
|
|
super(PesquisarPartidoView, self).get_filterset_kwargs(filterset_class) |
|
|
super(PesquisarPartidoView, self).get_filterset_kwargs(filterset_class) |
|
@ -322,19 +331,26 @@ class PesquisarPartidoView(FilterView): |
|
|
if data: |
|
|
if data: |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
url = "&" + str(self.request.META['QUERY_STRING']) |
|
|
if url.startswith("&page"): |
|
|
if url.startswith("&page"): |
|
|
ponto_comeco = url.find('nome=') - 1 |
|
|
url = '' |
|
|
url = url[ponto_comeco:] |
|
|
|
|
|
|
|
|
if 'nome' in self.request.META['QUERY_STRING'] or\ |
|
|
|
|
|
'page' in self.request.META['QUERY_STRING']: resultados = self.object_list |
|
|
|
|
|
else: |
|
|
|
|
|
resultados = [] |
|
|
|
|
|
|
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
context = self.get_context_data(filter=self.filterset, |
|
|
object_list=self.object_list, |
|
|
object_list=resultados, |
|
|
filter_url=url, |
|
|
filter_url=url, |
|
|
numero_res=len(self.object_list)) |
|
|
numero_res=len(resultados) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
context['show_results'] = show_results_filter_set( |
|
|
context['show_results'] = show_results_filter_set( |
|
|
self.request.GET.copy()) |
|
|
self.request.GET.copy()) |
|
|
|
|
|
|
|
|
return self.render_to_response(context) |
|
|
return self.render_to_response(context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ParticipacaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): |
|
|
class ParticipacaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): |
|
|
model = Participacao |
|
|
model = Participacao |
|
|
parent_field = 'parlamentar' |
|
|
parent_field = 'parlamentar' |
|
|