Browse Source

Correcao de bugs de pesquisa em sistemas (tabelas auxiliares) (#3511)

pull/3517/head
Gustavo274 3 years ago
committed by GitHub
parent
commit
45bb9578cb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      sapl/materia/views.py
  2. 22
      sapl/norma/views.py
  3. 46
      sapl/parlamentares/views.py

22
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,18 +434,22 @@ 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)

22
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,18 +100,22 @@ 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)

46
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'

Loading…
Cancel
Save