diff --git a/sapl/base/views.py b/sapl/base/views.py index 62c09755e..ab0ca587b 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -205,7 +205,7 @@ class RelatorioAtasView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -305,7 +305,7 @@ class RelatorioPresencaSessaoView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -327,7 +327,7 @@ class RelatorioHistoricoTramitacaoView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -363,7 +363,7 @@ class RelatorioMateriasTramitacaoView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -442,7 +442,7 @@ class RelatorioMateriasPorAnoAutorTipoView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -487,7 +487,7 @@ class RelatorioMateriasPorAutorView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index 39c17020b..c7a773a9c 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -17,6 +17,7 @@ from sapl.norma.models import (LegislacaoCitada, NormaJuridica, TipoNormaJuridica) from sapl.utils import models_with_gr_for_model + @pytest.mark.django_db(transaction=False) def make_unidade_tramitacao(descricao): # Cria uma comissão para ser a unidade de tramitação diff --git a/sapl/materia/tests/test_materia_form.py b/sapl/materia/tests/test_materia_form.py index a700ee45a..41ad04837 100644 --- a/sapl/materia/tests/test_materia_form.py +++ b/sapl/materia/tests/test_materia_form.py @@ -3,7 +3,8 @@ from django.utils.translation import ugettext as _ from model_mommy import mommy from sapl.materia import forms -from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa) +from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa + @pytest.mark.django_db(transaction=False) def test_valida_campos_obrigatorios_ficha_pesquisa_form(): @@ -19,6 +20,7 @@ def test_valida_campos_obrigatorios_ficha_pesquisa_form(): assert len(errors) == 3 + @pytest.mark.django_db(transaction=False) def test_ficha_pesquisa_form_datas_invalidas(): tipo = mommy.make(TipoMateriaLegislativa) @@ -29,7 +31,7 @@ def test_ficha_pesquisa_form_datas_invalidas(): }) assert not form.is_valid() assert form.errors['__all__'] == [_('A Data Final não pode ser menor que ' - 'a Data Inicial')] + 'a Data Inicial')] @pytest.mark.django_db(transaction=False) diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index a59dc8592..b6a87cd5f 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -8,8 +8,8 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, CriarProtocoloMateriaView, DespachoInicialCrud, DocumentoAcessorioCrud, DocumentoAcessorioEmLoteView, - ImpressosView, EtiquetaPesquisaView, - FichaPesquisaView, FichaSelecionaView, + EtiquetaPesquisaView, FichaPesquisaView, + FichaSelecionaView, ImpressosView, LegislacaoCitadaCrud, MateriaAssuntoCrud, MateriaLegislativaCrud, MateriaLegislativaPesquisaView, MateriaTaView, diff --git a/sapl/materia/views.py b/sapl/materia/views.py index a052bb707..358b76aca 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -14,7 +14,7 @@ from django.core.urlresolvers import reverse from django.http import HttpResponse, JsonResponse from django.http.response import Http404, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect -from django.template import loader, RequestContext +from django.template import RequestContext, loader from django.utils import formats from django.utils.translation import ugettext_lazy as _ from django.views.generic import CreateView, ListView, TemplateView, UpdateView @@ -141,7 +141,7 @@ class AdicionarVariasAutorias(PermissionRequiredForAppCrudMixin, FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -1517,7 +1517,7 @@ class MateriaLegislativaPesquisaView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -1626,7 +1626,7 @@ class DocumentoAcessorioEmLoteView(PermissionRequiredMixin, FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -1701,7 +1701,7 @@ class PrimeiraTramitacaoEmLoteView(PermissionRequiredMixin, FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -1848,6 +1848,7 @@ class FichaPesquisaView(PermissionRequiredMixin, FormView): return HttpResponseRedirect(url) + class FichaSelecionaView(PermissionRequiredMixin, FormView): form_class = FichaSelecionaForm template_name = 'materia/impressos/ficha_seleciona.html' @@ -1856,7 +1857,7 @@ class FichaSelecionaView(PermissionRequiredMixin, FormView): def get_context_data(self, **kwargs): if ('tipo' not in self.request.GET or 'data_inicial' not in self.request.GET or - 'data_final' not in self.request.GET): + 'data_final' not in self.request.GET): return HttpResponseRedirect(reverse( 'sapl.materia:impressos_ficha_pesquisa')) @@ -1875,13 +1876,14 @@ class FichaSelecionaView(PermissionRequiredMixin, FormView): context['quantidade'] = len(materia_list) materia_list = materia_list[:20] - context['form'].fields['materia'].choices = [(m.id, str(m)) for m in materia_list] + context['form'].fields['materia'].choices = [ + (m.id, str(m)) for m in materia_list] if context['quantidade'] > 20: messages.info(self.request, _('Sua pesquisa retornou mais do que ' - '20 impressos. Por questões de performance, foram retornados ' - 'apenas os 20 primeiros. Caso queira outros, tente fazer uma ' - 'pesquisa mais específica')) + '20 impressos. Por questões de performance, foram retornados ' + 'apenas os 20 primeiros. Caso queira outros, tente fazer uma ' + 'pesquisa mais específica')) return context @@ -1899,6 +1901,6 @@ class FichaSelecionaView(PermissionRequiredMixin, FormView): context['materia'] = materia context['despachos'] = materia.despachoinicial_set.all().values_list( - 'comissao__nome', flat=True) + 'comissao__nome', flat=True) return gerar_pdf_impressos(self.request, context, 'materia/impressos/ficha_pdf.html') diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 6ff7e3172..cd6a8c1dd 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -83,7 +83,7 @@ class NormaPesquisaView(FilterView): query_params = set(qr.keys()) if ((len(query_params) == 1 and 'iframe' in query_params) or - len(query_params) == 0): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 0a27e8c4e..6f4cf4265 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -25,9 +25,8 @@ from sapl.materia.models import Autoria, Proposicao, Relatoria from sapl.parlamentares.apps import AppConfig from sapl.utils import parlamentares_ativos -from .forms import (FiliacaoForm, LegislaturaForm, - MandatoForm, ParlamentarCreateForm, ParlamentarForm, - VotanteForm) +from .forms import (FiliacaoForm, LegislaturaForm, MandatoForm, + ParlamentarCreateForm, ParlamentarForm, VotanteForm) from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, Dependente, Filiacao, Frente, Legislatura, Mandato, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 4eb65d32b..5314c822f 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -215,7 +215,7 @@ class ProtocoloPesquisaView(PermissionRequiredMixin, FilterView): 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): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True @@ -575,7 +575,7 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin, 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): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py index 3edf60104..e454a9eee 100644 --- a/sapl/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -19,9 +19,8 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente, VotacaoNominalExpedienteDetailView, VotacaoNominalExpedienteEditView, VotacaoNominalExpedienteView, - VotacaoNominalView, VotacaoView, - abrir_votacao, atualizar_mesa, - insere_parlamentar_composicao, + VotacaoNominalView, VotacaoView, abrir_votacao, + atualizar_mesa, insere_parlamentar_composicao, mudar_ordem_materia_sessao, recuperar_materia, recuperar_numero_sessao, remove_parlamentar_composicao, diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 7886c4e50..142647ea3 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -117,7 +117,7 @@ def verifica_sessao_iniciada(request, spk): sessao = SessaoPlenaria.objects.get(id=spk) if not sessao.iniciada or sessao.finalizada: - msg = _('Não é possível abrir matérias para votação. '\ + msg = _('Não é possível abrir matérias para votação. ' 'Esta Sessão Plenária não foi iniciada ou está finalizada.') messages.add_message(request, messages.INFO, msg) return False @@ -143,8 +143,8 @@ def abrir_votacao(request, pk, spk): raise Http404 if (verifica_presenca(request, presenca_model, spk) and - verifica_votacoes_abertas(request) and - verifica_sessao_iniciada(request, spk)): + verifica_votacoes_abertas(request) and + verifica_sessao_iniciada(request, spk)): materia_votacao = model.objects.get(id=pk) materia_votacao.votacao_aberta = True materia_votacao.save() @@ -2458,7 +2458,7 @@ class PesquisarSessaoPlenariaView(FilterView): 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): + len(query_params) == 0): context['show_results'] = False else: context['show_results'] = True