diff --git a/sapl/base/views.py b/sapl/base/views.py index cae2052c9..62c09755e 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -202,6 +202,14 @@ class RelatorioAtasView(FilterView): context['object_list'] = context['object_list'].exclude(upload_ata='') qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context @@ -294,6 +302,14 @@ class RelatorioPresencaSessaoView(FilterView): # ===================================================================== qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context @@ -308,6 +324,14 @@ class RelatorioHistoricoTramitacaoView(FilterView): context['title'] = _('Histórico de Tramitações') qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context @@ -337,6 +361,13 @@ class RelatorioMateriasTramitacaoView(FilterView): qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context @@ -409,6 +440,13 @@ class RelatorioMateriasPorAnoAutorTipoView(FilterView): qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + if 'ano' in self.request.GET and self.request.GET['ano']: ano = int(self.request.GET['ano']) context['relatorio'] = self.get_materias_autor_ano(ano) @@ -447,6 +485,13 @@ class RelatorioMateriasPorAutorView(FilterView): qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context diff --git a/sapl/materia/views.py b/sapl/materia/views.py index f3aafb662..a052bb707 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -138,6 +138,14 @@ class AdicionarVariasAutorias(PermissionRequiredForAppCrudMixin, FilterView): context['title'] = _('Pesquisar Autores') qr = self.request.GET.copy() context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + context['pk_materia'] = self.kwargs['pk'] return context @@ -1507,6 +1515,13 @@ class MateriaLegislativaPesquisaView(FilterView): context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context @@ -1608,6 +1623,14 @@ class DocumentoAcessorioEmLoteView(PermissionRequiredMixin, FilterView): context['object_list'] = context['object_list'].order_by( 'ano', 'numero') context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context def post(self, request, *args, **kwargs): @@ -1675,6 +1698,14 @@ class PrimeiraTramitacaoEmLoteView(PermissionRequiredMixin, FilterView): 'ano', 'numero') context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context def post(self, request, *args, **kwargs): diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 8e70bd8e1..6ff7e3172 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -81,6 +81,13 @@ class NormaPesquisaView(FilterView): context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return context diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 82de1d73d..4eb65d32b 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -212,6 +212,14 @@ class ProtocoloPesquisaView(PermissionRequiredMixin, FilterView): numero_res=len(self.object_list) ) + qr = self.request.GET.copy() + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return self.render_to_response(context) @@ -564,6 +572,14 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin, numero_res=len(self.object_list) ) + qr = self.request.GET.copy() + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return self.render_to_response(context) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index c3775f3dd..7886c4e50 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -2455,6 +2455,14 @@ class PesquisarSessaoPlenariaView(FilterView): numero_res=len(self.object_list) ) + qr = self.request.GET.copy() + query_params = set(qr.keys()) + if ((len(query_params) == 1 and 'iframe' in query_params) or + len(query_params) == 0): + context['show_results'] = False + else: + context['show_results'] = True + return self.render_to_response(context) diff --git a/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html b/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html index 8cba5d186..421be8d06 100644 --- a/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html +++ b/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html @@ -3,11 +3,11 @@ {% load crispy_forms_tags %} {% block base_content %} - {% if not filter_url %} + {% if not show_results %} {% crispy filter.form %} {% endif %} - {% if filter_url %} + {% if show_results %}
diff --git a/sapl/templates/base/RelatorioMateriasPorAnoAutorTipo_filter.html b/sapl/templates/base/RelatorioMateriasPorAnoAutorTipo_filter.html index 23ef5e275..43deac36b 100644 --- a/sapl/templates/base/RelatorioMateriasPorAnoAutorTipo_filter.html +++ b/sapl/templates/base/RelatorioMateriasPorAnoAutorTipo_filter.html @@ -3,11 +3,11 @@ {% load crispy_forms_tags %} {% block base_content %} - {% if not filter_url %} + {% if not show_results %} {% crispy filter.form %} {% endif %} - {% if filter_url %} + {% if show_results %} diff --git a/sapl/templates/base/RelatorioMateriasPorAutor_filter.html b/sapl/templates/base/RelatorioMateriasPorAutor_filter.html index 889caf0f1..c75aad42b 100644 --- a/sapl/templates/base/RelatorioMateriasPorAutor_filter.html +++ b/sapl/templates/base/RelatorioMateriasPorAutor_filter.html @@ -3,11 +3,11 @@ {% load crispy_forms_tags %} {% block base_content %} - {% if not filter_url %} + {% if not show_results %} {% crispy filter.form %} {% endif %} - {% if filter_url %} + {% if show_results %} diff --git a/sapl/templates/base/RelatorioPresencaSessao_filter.html b/sapl/templates/base/RelatorioPresencaSessao_filter.html index ea3b1fca2..e3e447f8d 100644 --- a/sapl/templates/base/RelatorioPresencaSessao_filter.html +++ b/sapl/templates/base/RelatorioPresencaSessao_filter.html @@ -4,11 +4,11 @@ {% load common_tags %} {% block base_content %} - {% if not filter_url %} + {% if not show_results %} {% crispy filter.form %} {% endif %} - {% if filter_url %} + {% if show_results %}