diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 1be993568..daf0fe0cb 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -394,7 +394,7 @@ class StatusTramitacaoCrud(CrudAux): class PesquisarStatusTramitacaoView(FilterView): model = StatusTramitacao filterset_class = StatusTramitacaoFilterSet - paginate_by = 10 + paginate_by = 20 def get_filterset_kwargs(self, filterset_class): super(PesquisarStatusTramitacaoView, self).get_filterset_kwargs( @@ -434,17 +434,21 @@ class PesquisarStatusTramitacaoView(FilterView): if data: url = '&' + str(self.request.META["QUERY_STRING"]) if url.startswith("&page"): - ponto_comeco = url.find("descricao=") - 1 - url = url[ponto_comeco:] + url = '' - context = self.get_context_data( - filter=self.filterset, object_list=self.object_list, - filter_url=url, numero_res=len(self.object_list) - ) + if 'descricao' in self.request.META['QUERY_STRING'] or\ + 'page' in self.request.META['QUERY_STRING']: resultados = self.object_list + else: + resultados = [] - context["show_results"] = show_results_filter_set( - self.request.GET.copy() - ) + context = self.get_context_data(filter=self.filterset, + object_list=resultados, + filter_url=url, + numero_res=len(resultados) + ) + + context['show_results'] = show_results_filter_set( + self.request.GET.copy()) return self.render_to_response(context) diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 223728afd..256399256 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -60,7 +60,7 @@ class AssuntoNormaCrud(CrudAux): class PesquisarAssuntoNormaView(FilterView): model = AssuntoNorma filterset_class = AssuntoNormaFilterSet - paginate_by = 10 + paginate_by = 20 def get_filterset_kwargs(self, filterset_class): super(PesquisarAssuntoNormaView, self).get_filterset_kwargs( @@ -100,17 +100,21 @@ class PesquisarAssuntoNormaView(FilterView): if data: url = '&' + str(self.request.META["QUERY_STRING"]) if url.startswith("&page"): - ponto_comeco = url.find("assunto=") - 1 - url = url[ponto_comeco:] + url = '' - context = self.get_context_data( - filter=self.filterset, object_list=self.object_list, - filter_url=url, numero_res=len(self.object_list) - ) + if 'assunto' in self.request.META['QUERY_STRING'] or\ + 'page' in self.request.META['QUERY_STRING']: resultados = self.object_list + else: + resultados = [] - context["show_results"] = show_results_filter_set( - self.request.GET.copy() - ) + context = self.get_context_data(filter=self.filterset, + object_list=resultados, + filter_url=url, + numero_res=len(resultados) + ) + + context['show_results'] = show_results_filter_set( + self.request.GET.copy()) return self.render_to_response(context) diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 0a0ef831c..9ae0c54bc 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -183,7 +183,7 @@ class ProposicaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): class PesquisarParlamentarView(FilterView): model = Parlamentar filterset_class = ParlamentarFilterSet - paginate_by = 10 + paginate_by = 20 def get_filterset_kwargs(self, filterset_class): super(PesquisarParlamentarView, @@ -222,13 +222,17 @@ class PesquisarParlamentarView(FilterView): if data: url = "&" + str(self.request.META['QUERY_STRING']) if url.startswith("&page"): - ponto_comeco = url.find('nome_parlamentar=') - 1 - url = url[ponto_comeco:] + url = '' + + 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, - object_list=self.object_list, + object_list=resultados, filter_url=url, - numero_res=len(self.object_list) + numero_res=len(resultados) ) context['show_results'] = show_results_filter_set( @@ -240,7 +244,7 @@ class PesquisarParlamentarView(FilterView): class PesquisarColigacaoView(FilterView): model = Coligacao filterset_class = ColigacaoFilterSet - paginate_by = 10 + paginate_by = 20 def get_filterset_kwargs(self, filterset_class): super(PesquisarColigacaoView, self).get_filterset_kwargs(filterset_class) @@ -273,13 +277,18 @@ class PesquisarColigacaoView(FilterView): if data: url = "&" + str(self.request.META['QUERY_STRING']) if url.startswith("&page"): - ponto_comeco = url.find('nome=') - 1 - url = url[ponto_comeco:] + url = '' + + 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, - object_list=self.object_list, + object_list=resultados, filter_url=url, - numero_res=len(self.object_list)) + numero_res=len(resultados) + ) context['show_results'] = show_results_filter_set( self.request.GET.copy()) @@ -290,7 +299,7 @@ class PesquisarColigacaoView(FilterView): class PesquisarPartidoView(FilterView): model = Partido filterset_class = PartidoFilterSet - paginate_by = 10 + paginate_by = 20 def get_filterset_kwargs(self, filterset_class): super(PesquisarPartidoView, self).get_filterset_kwargs(filterset_class) @@ -322,19 +331,26 @@ class PesquisarPartidoView(FilterView): if data: url = "&" + str(self.request.META['QUERY_STRING']) if url.startswith("&page"): - ponto_comeco = url.find('nome=') - 1 - url = url[ponto_comeco:] + url = '' + + 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, - object_list=self.object_list, + object_list=resultados, filter_url=url, - numero_res=len(self.object_list)) + numero_res=len(resultados) + ) + context['show_results'] = show_results_filter_set( self.request.GET.copy()) return self.render_to_response(context) + class ParticipacaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): model = Participacao parent_field = 'parlamentar'