diff --git a/create_admin.py b/create_admin.py index eb60ac940..c69d18062 100644 --- a/create_admin.py +++ b/create_admin.py @@ -1,6 +1,8 @@ import os import sys + import django + from sapl import settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sapl.settings") diff --git a/sapl/api/forms.py b/sapl/api/forms.py index f70ffe2f2..f8ad6fee7 100644 --- a/sapl/api/forms.py +++ b/sapl/api/forms.py @@ -1,9 +1,9 @@ -from django.db.models import Q, F +from django.db.models import F, Q from django.forms.fields import CharField, MultiValueField from django.forms.widgets import MultiWidget, TextInput from django.utils import timezone from django.utils.translation import ugettext_lazy as _ -from django_filters.filters import MethodFilter, ModelChoiceFilter, DateFilter +from django_filters.filters import DateFilter, MethodFilter, ModelChoiceFilter from rest_framework import serializers from rest_framework.compat import django_filters from rest_framework.filters import FilterSet diff --git a/sapl/api/urls.py b/sapl/api/urls.py index 314b2b339..1f19e9d1f 100644 --- a/sapl/api/urls.py +++ b/sapl/api/urls.py @@ -2,9 +2,9 @@ from django.conf import settings from django.conf.urls import include, url from rest_framework.routers import DefaultRouter -from sapl.api.views import (AutorListView, MateriaLegislativaViewSet, - ModelChoiceView, SessaoPlenariaViewSet, - AutoresPossiveisListView, AutoresProvaveisListView) +from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView, + AutorListView, MateriaLegislativaViewSet, + ModelChoiceView, SessaoPlenariaViewSet) from .apps import AppConfig diff --git a/sapl/api/views.py b/sapl/api/views.py index 7c8ddcf8d..1eccaf5ef 100644 --- a/sapl/api/views.py +++ b/sapl/api/views.py @@ -9,8 +9,8 @@ from rest_framework.permissions import (AllowAny, IsAuthenticated, IsAuthenticatedOrReadOnly) from rest_framework.viewsets import GenericViewSet, ModelViewSet -from sapl.api.forms import AutorChoiceFilterSet, AutorSearchForFieldFilterSet,\ - AutoresPossiveisFilterSet +from sapl.api.forms import (AutorChoiceFilterSet, AutoresPossiveisFilterSet, + AutorSearchForFieldFilterSet) from sapl.api.serializers import (AutorChoiceSerializer, AutorSerializer, ChoiceSerializer, MateriaLegislativaSerializer, diff --git a/sapl/base/forms.py b/sapl/base/forms.py index f95cc9bb8..13880703c 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1,3 +1,4 @@ +import django_filters from crispy_forms.bootstrap import FieldWithButtons, InlineRadios, StrictButton from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button, Div, Field, Fieldset, Layout, Row @@ -12,9 +13,8 @@ from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.db import models, transaction from django.forms import ModelForm -from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ -import django_filters +from django.utils.translation import string_concat from sapl.base.models import Autor, TipoAutor from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column, @@ -29,7 +29,6 @@ from sapl.utils import (RANGE_ANOS, ChoiceWithoutValidationField, from .models import AppConfig, CasaLegislativa - ACTION_CREATE_USERS_AUTOR_CHOICE = [ ('C', _('Criar novo Usuário')), ('A', _('Associar um usuário existente')), diff --git a/sapl/base/models.py b/sapl/base/models.py index 2917ea3ea..c75091341 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -1,12 +1,11 @@ +import reversion from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.translation import ugettext_lazy as _ -import reversion from sapl.utils import UF, YES_NO_CHOICES, get_settings_auth_user_model - TIPO_DOCUMENTO_ADMINISTRATIVO = (('O', _('Ostensivo')), ('R', _('Restritivo'))) diff --git a/sapl/base/urls.py b/sapl/base/urls.py index 500d44f04..ed55f1767 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -16,8 +16,7 @@ from .views import (AppConfigCrud, CasaLegislativaCrud, HelpView, RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAutorView, RelatorioMateriasTramitacaoView, - RelatorioPresencaSessaoView, - SaplSearchView) + RelatorioPresencaSessaoView, SaplSearchView) app_name = AppConfig.name diff --git a/sapl/base/views.py b/sapl/base/views.py index 1450bc16b..f8c0832cf 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -14,7 +14,6 @@ from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView from django_filters.views import FilterView - from haystack.views import SearchView from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm @@ -22,7 +21,8 @@ from sapl.base.models import Autor, TipoAutor from sapl.crud.base import CrudAux from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.parlamentares.models import Parlamentar -from sapl.sessao.models import PresencaOrdemDia, SessaoPlenaria, SessaoPlenariaPresenca +from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria, + SessaoPlenariaPresenca) from sapl.utils import parlamentares_ativos, sapl_logger from .forms import (CasaLegislativaForm, ConfiguracoesAppForm, @@ -497,4 +497,4 @@ class SaplSearchView(SearchView): for m in models: context['models'] = context['models'] + '&models=' + m - return context \ No newline at end of file + return context diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index e46a193e1..eec259190 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -1,5 +1,6 @@ from math import ceil +import rtyaml from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit @@ -7,7 +8,6 @@ from django import template from django.core.urlresolvers import reverse from django.utils import formats from django.utils.translation import ugettext as _ -import rtyaml def heads_and_tails(list_of_lists): diff --git a/sapl/crud/base.py b/sapl/crud/base.py index 70ea1c859..05c2b03a9 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -17,8 +17,8 @@ from django.http.response import Http404 from django.shortcuts import redirect from django.utils.decorators import classonlymethod from django.utils.encoding import force_text -from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import string_concat from django.views.generic import (CreateView, DeleteView, DetailView, ListView, UpdateView) from django.views.generic.base import ContextMixin @@ -30,7 +30,6 @@ from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL, from sapl.settings import BASE_DIR from sapl.utils import normalize - logger = logging.getLogger(BASE_DIR.name) ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \ diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index fcf2f0837..a405b8f0b 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -12,7 +12,7 @@ from django.contrib.auth.models import Group from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db import OperationalError, ProgrammingError, connections, models -from django.db.models import CharField, Max, ProtectedError, TextField, Count +from django.db.models import CharField, Count, Max, ProtectedError, TextField from django.db.models.base import ModelBase from django.db.models.signals import post_delete, post_save from model_mommy import mommy @@ -26,11 +26,11 @@ from sapl.materia.models import (AcompanhamentoMateria, DocumentoAcessorio, StatusTramitacao, TipoDocumento, TipoMateriaLegislativa, TipoProposicao, Tramitacao) -from sapl.norma.models import (AssuntoNorma, NormaJuridica, - TipoVinculoNormaJuridica, NormaRelacionada) -from sapl.parlamentares.models import (Legislatura,Mandato, Parlamentar, +from sapl.norma.models import (AssuntoNorma, NormaJuridica, NormaRelacionada, + TipoVinculoNormaJuridica) +from sapl.parlamentares.models import (Legislatura, Mandato, Parlamentar, TipoAfastamento) -from sapl.protocoloadm.models import (DocumentoAdministrativo,Protocolo, +from sapl.protocoloadm.models import (DocumentoAdministrativo, Protocolo, StatusTramitacaoAdministrativo) from sapl.sessao.models import ExpedienteMateria, OrdemDia, RegistroVotacao from sapl.settings import PROJECT_DIR diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 5f5279d39..21d1845d8 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1,7 +1,8 @@ -from datetime import date, datetime import os +from datetime import date, datetime +import django_filters from crispy_forms.bootstrap import Alert, FormActions, InlineRadios from crispy_forms.helper import FormHelper from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, @@ -13,16 +14,16 @@ from django.core.files.base import File from django.core.urlresolvers import reverse from django.db import models, transaction from django.db.models import Max -from django.forms import ModelForm, ModelChoiceField, widgets +from django.forms import ModelChoiceField, ModelForm, widgets from django.forms.forms import Form from django.forms.models import ModelMultipleChoiceField -from django.forms.widgets import Select, CheckboxSelectMultiple, HiddenInput +from django.forms.widgets import CheckboxSelectMultiple, HiddenInput, Select from django.utils.encoding import force_text from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ -import django_filters +import sapl from sapl.base.models import Autor, TipoAutor from sapl.comissoes.models import Comissao from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, @@ -41,7 +42,6 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, MateriaPesquisaOrderingFilter, RangeWidgetOverride, autor_label, autor_modal, models_with_gr_for_model, qs_override_django_filter) -import sapl from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, DocumentoAcessorio, Numeracao, Proposicao, Relatoria, diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 36d375068..cd44363b4 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -1,5 +1,6 @@ from datetime import datetime +import reversion from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType @@ -8,7 +9,6 @@ from django.db import models from django.utils import formats from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -import reversion from sapl.base.models import Autor from sapl.comissoes.models import Comissao @@ -19,7 +19,6 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, SaplGenericForeignKey, SaplGenericRelation, restringe_tipos_de_arquivo_txt, texto_upload_path) - EM_TRAMITACAO = [(1, 'Sim'), (0, 'Não')] diff --git a/sapl/materia/signals.py b/sapl/materia/signals.py index f1cf66e03..e774b0191 100644 --- a/sapl/materia/signals.py +++ b/sapl/materia/signals.py @@ -1,8 +1,6 @@ -from django.db.models.signals import post_delete, post_save - import django.dispatch +from django.db.models.signals import post_delete, post_save from .models import DocumentoAcessorio, MateriaLegislativa - tramitacao_signal = django.dispatch.Signal(providing_args=['post', 'request']) diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index 0090376bf..071d51d4c 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -1,9 +1,9 @@ +import pytest from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse from model_mommy import mommy -import pytest from sapl.base.models import Autor, TipoAutor from sapl.comissoes.models import Comissao, TipoComissao diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index d588f1f20..2cbb3a62b 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -4,8 +4,9 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, AcompanhamentoExcluirView, AcompanhamentoMateriaView, AnexadaCrud, AssuntoMateriaCrud, AutoriaCrud, - ConfirmarProposicao, CriarProtocoloMateriaView, - DespachoInicialCrud, DocumentoAcessorioCrud, + AutoriaMultiCreateView, ConfirmarProposicao, + CriarProtocoloMateriaView, DespachoInicialCrud, + DocumentoAcessorioCrud, DocumentoAcessorioEmLoteView, LegislacaoCitadaCrud, MateriaAssuntoCrud, MateriaLegislativaCrud, @@ -20,13 +21,11 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, TipoFimRelatoriaCrud, TipoMateriaCrud, TipoProposicaoCrud, TramitacaoCrud, TramitacaoEmLoteView, UnidadeTramitacaoCrud, - proposicao_texto, recuperar_materia, - AutoriaMultiCreateView) + proposicao_texto, recuperar_materia) from . import receivers from .apps import AppConfig - app_name = AppConfig.name urlpatterns_materia = [ diff --git a/sapl/materia/views.py b/sapl/materia/views.py index c4cf64639..a206ae06f 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -1,4 +1,4 @@ -from datetime import datetime, date +from datetime import date, datetime from random import choice from string import ascii_letters, digits @@ -9,8 +9,7 @@ from django.contrib import messages from django.contrib.auth.decorators import permission_required from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.contenttypes.models import ContentType -from django.core.exceptions import (ObjectDoesNotExist, - MultipleObjectsReturned) +from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponse, JsonResponse @@ -23,6 +22,7 @@ from django.views.generic.base import RedirectView from django.views.generic.edit import FormView from django_filters.views import FilterView +import sapl from sapl.base.models import Autor, CasaLegislativa from sapl.comissoes.models import Comissao, Participacao from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, @@ -33,16 +33,16 @@ from sapl.crud.base import (ACTION_CREATE, ACTION_DELETE, ACTION_DETAIL, ACTION_LIST, ACTION_UPDATE, RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud, PermissionRequiredForAppCrudMixin, make_pagination) -from sapl.materia.forms import (AnexadaForm, ConfirmarProposicaoForm, - LegislacaoCitadaForm, AutoriaForm, ProposicaoForm, - TipoProposicaoForm, TramitacaoForm, - TramitacaoUpdateForm, AutoriaMultiCreateForm) +from sapl.materia.forms import (AnexadaForm, AutoriaForm, + AutoriaMultiCreateForm, + ConfirmarProposicaoForm, LegislacaoCitadaForm, + ProposicaoForm, TipoProposicaoForm, + TramitacaoForm, TramitacaoUpdateForm) from sapl.norma.models import LegislacaoCitada from sapl.protocoloadm.models import Protocolo from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, autor_modal, gerar_hash_arquivo, get_base_url, montar_row_autor) -import sapl from .email_utils import do_envia_email_confirmacao from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, @@ -62,7 +62,6 @@ from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, TipoProposicao, Tramitacao, UnidadeTramitacao) from .signals import tramitacao_signal - AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia') OrigemCrud = Crud.build(Origem, '') diff --git a/sapl/painel/urls.py b/sapl/painel/urls.py index 29890f30f..66ef92ac1 100644 --- a/sapl/painel/urls.py +++ b/sapl/painel/urls.py @@ -2,8 +2,8 @@ from django.conf.urls import url from .apps import AppConfig from .views import (cronometro_painel, get_dados_painel, painel_mensagem_view, - painel_parlamentar_view, painel_view, - painel_votacao_view, votante_view) + painel_parlamentar_view, painel_view, painel_votacao_view, + votante_view) app_name = AppConfig.name diff --git a/sapl/painel/views.py b/sapl/painel/views.py index e3271a309..13ee7883b 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -2,9 +2,9 @@ from datetime import date from django.contrib import messages from django.contrib.auth.decorators import user_passes_test -from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned -from django.db.models import Q +from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.core.urlresolvers import reverse +from django.db.models import Q from django.http import HttpResponse, JsonResponse from django.http.response import Http404, HttpResponseRedirect from django.shortcuts import render diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py index 34aa8b3e8..8bbc3704f 100644 --- a/sapl/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -1,9 +1,9 @@ from datetime import datetime +import reversion from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -import reversion from sapl.base.models import Autor from sapl.utils import (INDICADOR_AFASTAMENTO, UF, YES_NO_CHOICES, diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py index 7b0f8f031..e383421c4 100644 --- a/sapl/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -5,8 +5,7 @@ from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, FiliacaoCrud, FrenteCrud, FrenteList, LegislaturaCrud, MandatoCrud, MesaDiretoraView, NivelInstrucaoCrud, - ParlamentarCrud, - ParlamentarMateriasView, + ParlamentarCrud, ParlamentarMateriasView, ParticipacaoParlamentarCrud, PartidoCrud, ProposicaoParlamentarCrud, RelatoriaParlamentarCrud, diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 9af917370..2890dc384 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -21,8 +21,7 @@ from sapl.comissoes.models import Participacao from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux, CrudBaseForListAndDetailExternalAppView, MasterDetailCrud) -from sapl.materia.models import Autoria -from sapl.materia.models import Proposicao, Relatoria +from sapl.materia.models import Autoria, Proposicao, Relatoria from sapl.parlamentares.apps import AppConfig from sapl.utils import parlamentares_ativos @@ -34,7 +33,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, SituacaoMilitar, TipoAfastamento, TipoDependente, Votante) - CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa') PartidoCrud = CrudAux.build(Partido, 'partidos') SessaoLegislativaCrud = CrudAux.build(SessaoLegislativa, 'sessao_legislativa') diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 24319ac05..fc2b99dc8 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -1,5 +1,6 @@ from datetime import datetime +import django_filters from crispy_forms.bootstrap import InlineRadios from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button, Fieldset, Layout, Submit @@ -8,11 +9,11 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db import models from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import django_filters from sapl.base.models import Autor, TipoAutor from sapl.crispy_layout_mixin import form_actions, to_row -from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa, UnidadeTramitacao +from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa, + UnidadeTramitacao) from sapl.utils import (RANGE_ANOS, AnoNumeroOrderingFilter, RangeWidgetOverride, autor_label, autor_modal) @@ -20,7 +21,6 @@ from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, TipoDocumentoAdministrativo, TramitacaoAdministrativo) - TIPOS_PROTOCOLO = [('0', 'Recebido'), ('1', 'Enviado'), ('', 'Ambos')] TIPOS_PROTOCOLO_CREATE = [('0', 'Recebido'), ('1', 'Enviado')] diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index e26168d0d..dba1d9f6d 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -1,13 +1,12 @@ from datetime import date, datetime - from braces.views import FormValidMessageMixin from django.contrib import messages from django.contrib.auth.mixins import PermissionRequiredMixin -from django.db.models import Q +from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse -from django.db.models import Max +from django.db.models import Max, Q from django.http import (Http404, HttpResponse, HttpResponseRedirect, JsonResponse) from django.shortcuts import redirect @@ -18,8 +17,11 @@ from django_filters.views import FilterView import sapl from sapl.base.models import Autor +from sapl.comissoes.models import Comissao from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa +from sapl.parlamentares.models import Parlamentar +from sapl.protocoloadm.models import Protocolo from sapl.utils import create_barcode, get_client_ip from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, @@ -30,10 +32,6 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, StatusTramitacaoAdministrativo, TipoDocumentoAdministrativo, TramitacaoAdministrativo) -from sapl.parlamentares.models import Parlamentar -from sapl.protocoloadm.models import Protocolo -from sapl.comissoes.models import Comissao -from django.contrib.contenttypes.models import ContentType TipoDocumentoAdministrativoCrud = CrudAux.build( TipoDocumentoAdministrativo, '') diff --git a/sapl/redireciona_urls/urls.py b/sapl/redireciona_urls/urls.py index 8e8ac7d99..63afd8b6b 100644 --- a/sapl/redireciona_urls/urls.py +++ b/sapl/redireciona_urls/urls.py @@ -1,24 +1,18 @@ -from .apps import AppConfig -from .views import ( - RedirecionaAtasList, - RedirecionaComissao, - RedirecionaHistoricoTramitacoesList, - RedirecionaMateriaLegislativaDetail, - RedirecionaMateriaLegislativaList, - RedirecionaMateriasPorAnoAutorTipo, - RedirecionaMateriasPorAutor, - RedirecionaMesaDiretoraView, - RedirecionaNormasJuridicasDetail, - RedirecionaNormasJuridicasList, - RedirecionaParlamentar, - RedirecionaPautaSessao, - RedirecionaPresencaParlamentares, - RedirecionaRelatoriosList, - RedirecionaRelatoriosMateriasEmTramitacaoList, - RedirecionaSessaoPlenaria, - RedirecionaSAPLIndex) from django.conf.urls import url +from .apps import AppConfig +from .views import (RedirecionaAtasList, RedirecionaComissao, + RedirecionaHistoricoTramitacoesList, + RedirecionaMateriaLegislativaDetail, + RedirecionaMateriaLegislativaList, + RedirecionaMateriasPorAnoAutorTipo, + RedirecionaMateriasPorAutor, RedirecionaMesaDiretoraView, + RedirecionaNormasJuridicasDetail, + RedirecionaNormasJuridicasList, RedirecionaParlamentar, + RedirecionaPautaSessao, RedirecionaPresencaParlamentares, + RedirecionaRelatoriosList, + RedirecionaRelatoriosMateriasEmTramitacaoList, + RedirecionaSAPLIndex, RedirecionaSessaoPlenaria) app_name = AppConfig.name diff --git a/sapl/redireciona_urls/views.py b/sapl/redireciona_urls/views.py index 42b0fcadd..3e29e8989 100644 --- a/sapl/redireciona_urls/views.py +++ b/sapl/redireciona_urls/views.py @@ -1,6 +1,6 @@ -from .exceptions import UnknownUrlNameError from django.core.urlresolvers import NoReverseMatch, reverse from django.views.generic import RedirectView + from sapl.base.apps import AppConfig as atasConfig from sapl.base.apps import AppConfig as presenca_sessaoConfig from sapl.base.apps import AppConfig as relatoriosConfig @@ -10,6 +10,8 @@ from sapl.norma.apps import AppConfig as normaConfig from sapl.parlamentares.apps import AppConfig as parlamentaresConfig from sapl.sessao.apps import AppConfig as sessaoConfig +from .exceptions import UnknownUrlNameError + EMPTY_STRING = '' app_parlamentares = parlamentaresConfig.name diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index ffd371600..48d4fee60 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -19,7 +19,7 @@ from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, SessaoPlenaria, SessaoPlenariaPresenca, TipoExpediente) from sapl.settings import STATIC_ROOT -from sapl.utils import filiacao_data, UF +from sapl.utils import UF, filiacao_data from .templates import (pdf_capa_processo_gerar, pdf_documento_administrativo_gerar, pdf_espelho_gerar, diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 2b9e6788c..8cc4d69d2 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -10,8 +10,8 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crispy_layout_mixin import form_actions, to_row from sapl.materia.forms import MateriaLegislativaFilterSet -from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa, - StatusTramitacao) +from sapl.materia.models import (MateriaLegislativa, StatusTramitacao, + TipoMateriaLegislativa) from sapl.parlamentares.models import Parlamentar from sapl.utils import (RANGE_DIAS_MES, RANGE_MESES, MateriaPesquisaOrderingFilter, autor_label, diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 83217c54e..2c1d30403 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -30,22 +30,23 @@ from sapl.materia.models import (Autoria, DocumentoAcessorio, TipoMateriaLegislativa, Tramitacao) from sapl.materia.views import MateriaLegislativaPesquisaView from sapl.norma.models import NormaJuridica -from sapl.parlamentares.models import (Filiacao, Legislatura, Parlamentar, - SessaoLegislativa, Mandato) +from sapl.parlamentares.models import (Filiacao, Legislatura, Mandato, + Parlamentar, SessaoLegislativa) from sapl.sessao.apps import AppConfig from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm + from .forms import (AdicionarVariasMateriasFilterSet, ExpedienteForm, ListMateriaForm, MesaForm, OradorExpedienteForm, OradorForm, PautaSessaoFilterSet, PresencaForm, - ResumoOrdenacaoForm, SessaoPlenariaFilterSet, SessaoPlenariaForm, - VotacaoEditForm, VotacaoForm, VotacaoNominalForm) + ResumoOrdenacaoForm, SessaoPlenariaFilterSet, + SessaoPlenariaForm, VotacaoEditForm, VotacaoForm, + VotacaoNominalForm) from .models import (Bancada, Bloco, CargoBancada, CargoMesa, ExpedienteMateria, ExpedienteSessao, IntegranteMesa, MateriaLegislativa, Orador, OradorExpediente, OrdemDia, PresencaOrdemDia, RegistroVotacao, ResumoOrdenacao, SessaoPlenaria, SessaoPlenariaPresenca, TipoExpediente, - TipoResultadoVotacao, TipoSessaoPlenaria, - VotoParlamentar) + TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') TipoExpedienteCrud = CrudAux.build(TipoExpediente, 'tipo_expediente') diff --git a/sapl/settings.py b/sapl/settings.py index 903b38b6a..274e2ed0a 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -22,7 +22,6 @@ from unipath import Path from .temp_suppress_crispy_form_warnings import \ SUPRESS_CRISPY_FORM_WARNINGS_LOGGING - BASE_DIR = Path(__file__).ancestor(1) PROJECT_DIR = Path(__file__).ancestor(2) diff --git a/sapl/utils.py b/sapl/utils.py index f707a2c91..90581bd99 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -3,7 +3,6 @@ import logging import os import re from datetime import date -from django_filters.filterset import STRICTNESS from functools import wraps from subprocess import PIPE, call from threading import Thread @@ -15,21 +14,21 @@ from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button from django import forms from django.apps import apps -from django.db.models import Q from django.conf import settings from django.contrib import admin from django.contrib.contenttypes.fields import (GenericForeignKey, GenericRel, GenericRelation) from django.core.exceptions import ValidationError +from django.db.models import Q from django.utils import six from django.utils.translation import ugettext_lazy as _ +from django_filters.filterset import STRICTNESS from floppyforms import ClearableFileInput from reversion.admin import VersionAdmin from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.settings import BASE_DIR, PROJECT_DIR - sapl_logger = logging.getLogger(BASE_DIR.name) @@ -642,4 +641,4 @@ def parlamentares_ativos(data_inicio, data_fim=None): 'parlamentar_id', flat=True).distinct('parlamentar_id') - return Parlamentar.objects.filter(id__in=parlamentares_id) \ No newline at end of file + return Parlamentar.objects.filter(id__in=parlamentares_id) diff --git a/scripts/set_inicio_mandato.py b/scripts/set_inicio_mandato.py index 37dfcfc0c..dca509ab6 100644 --- a/scripts/set_inicio_mandato.py +++ b/scripts/set_inicio_mandato.py @@ -7,4 +7,4 @@ def popula_campo_data_inicio(): m.save() if __name__ == '__main__': - popula_campo_data_inicio() \ No newline at end of file + popula_campo_data_inicio()