From ffac50bdcc18a28f99c09cec86a1f844cc94dd81 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 7 Oct 2016 17:46:59 -0300 Subject: [PATCH] =?UTF-8?q?HOT-FIX:=20conserta=20ordem=20importa=C3=A7?= =?UTF-8?q?=C3=A3o=20e=20prefixo=20'base'=20em=20app=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/forms.py | 2 +- sapl/base/models.py | 3 +-- sapl/base/templatetags/menus.py | 3 +-- sapl/base/urls.py | 16 ++++++++-------- sapl/compilacao/urls.py | 6 +++--- sapl/compilacao/views.py | 10 +++++----- sapl/crud/base.py | 3 +-- sapl/materia/forms.py | 1 + sapl/materia/views.py | 3 +-- sapl/norma/views.py | 1 - sapl/protocoloadm/views.py | 3 +-- sapl/relatorios/views.py | 2 +- sapl/sessao/views.py | 1 - sapl/test_general.py | 3 ++- sapl/test_urls.py | 7 +++---- 15 files changed, 29 insertions(+), 35 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 605d23b84..952db3b35 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1,3 +1,4 @@ +import django_filters from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button, Fieldset, Layout from django import forms @@ -6,7 +7,6 @@ from django.core.exceptions import ValidationError from django.db import models from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import django_filters from sapl.crispy_layout_mixin import form_actions, to_row from sapl.materia.models import MateriaLegislativa diff --git a/sapl/base/models.py b/sapl/base/models.py index 1762aaa0a..7872f2c21 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -7,12 +7,11 @@ from django.contrib.contenttypes.models import ContentType from django.core import exceptions from django.db import models, router from django.db.utils import DEFAULT_DB_ALIAS -from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import string_concat from sapl.utils import UF, YES_NO_CHOICES - TIPO_DOCUMENTO_ADMINISTRATIVO = (('O', _('Ostensivo')), ('R', _('Restritivo'))) diff --git a/sapl/base/templatetags/menus.py b/sapl/base/templatetags/menus.py index 61c468acf..3cbf5e46c 100644 --- a/sapl/base/templatetags/menus.py +++ b/sapl/base/templatetags/menus.py @@ -1,7 +1,6 @@ +import yaml from django import template from django.core.urlresolvers import reverse -import yaml - register = template.Library() diff --git a/sapl/base/urls.py b/sapl/base/urls.py index 5611ab354..1d93641af 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -25,30 +25,30 @@ urlpatterns = [ url(r'^ajuda/(?P\w+)$', HelpView.as_view(), name='help_topic'), url(r'^ajuda/', TemplateView.as_view(template_name='ajuda/index.html'), name='help_base'), - url(r'^casa-legislativa/', include(CasaLegislativaCrud.get_urls()), + url(r'^sistema/casa-legislativa/', include(CasaLegislativaCrud.get_urls()), name="casa_legislativa"), - url(r'^app-config/', include(AppConfigCrud.get_urls())), + url(r'^sistema/app-config/', include(AppConfigCrud.get_urls())), url(r'^login/$', views.login, { 'template_name': 'base/login.html', 'authentication_form': LoginForm}, name='login'), url(r'^logout/$', views.logout, {'next_page': '/login'}, name='logout'), - url(r'^relatorios/materia-por-autor$', + url(r'^sistema/relatorios/materia-por-autor$', RelatorioMateriasPorAutorView.as_view(), name='materia_por_autor'), - url(r'^relatorios/materia-por-ano-autor-tipo$', + url(r'^sistema/relatorios/materia-por-ano-autor-tipo$', RelatorioMateriasPorAnoAutorTipoView.as_view(), name='materia_por_ano_autor_tipo'), - url(r'^relatorios/materia-por-tramitacao$', + url(r'^sistema/relatorios/materia-por-tramitacao$', RelatorioMateriasTramitacaoView.as_view(), name='materia_por_tramitacao'), - url(r'^relatorios/historico-tramitacoes$', + url(r'^sistema/relatorios/historico-tramitacoes$', RelatorioHistoricoTramitacaoView.as_view(), name='historico_tramitacoes'), - url(r'^relatorios/presenca$', + url(r'^sistema/relatorios/presenca$', RelatorioPresencaSessaoView.as_view(), name='presenca_sessao'), - url(r'^relatorios/atas$', + url(r'^sistema/relatorios/atas$', RelatorioAtasView.as_view(), name='atas'), diff --git a/sapl/compilacao/urls.py b/sapl/compilacao/urls.py index 1f7eb5195..aaf8d3543 100644 --- a/sapl/compilacao/urls.py +++ b/sapl/compilacao/urls.py @@ -1,9 +1,9 @@ from django.conf.urls import include, url from sapl.compilacao import views -from sapl.compilacao.views import (TipoNotaCrud, TipoPublicacaoCrud, - TipoVideCrud, VeiculoPublicacaoCrud, - TipoDispositivoCrud) +from sapl.compilacao.views import (TipoDispositivoCrud, TipoNotaCrud, + TipoPublicacaoCrud, TipoVideCrud, + VeiculoPublicacaoCrud) from .apps import AppConfig diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py index 0d6565815..95cd92e97 100644 --- a/sapl/compilacao/views.py +++ b/sapl/compilacao/views.py @@ -1,7 +1,7 @@ -from collections import OrderedDict -from datetime import datetime, timedelta import logging import sys +from collections import OrderedDict +from datetime import datetime, timedelta from braces.views import FormMessagesMixin from django import forms @@ -11,7 +11,7 @@ from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.core.signing import Signer from django.core.urlresolvers import reverse_lazy -from django.db import transaction, connection +from django.db import connection, transaction from django.db.models import Q from django.db.utils import IntegrityError from django.http.response import (HttpResponse, HttpResponseRedirect, @@ -20,7 +20,8 @@ from django.shortcuts import get_object_or_404, redirect from django.utils.dateparse import parse_date from django.utils.decorators import method_decorator from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _, string_concat +from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import string_concat from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from django.views.generic.edit import (CreateView, DeleteView, FormView, @@ -47,7 +48,6 @@ from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED, DISPOSITIVO_SELECT_RELATED_EDIT) from sapl.crud.base import Crud, CrudListView, make_pagination - TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota') TipoVideCrud = Crud.build(TipoVide, 'tipo_vide') TipoPublicacaoCrud = Crud.build(TipoPublicacao, 'tipo_publicacao') diff --git a/sapl/crud/base.py b/sapl/crud/base.py index c6283aa5c..97aef7461 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -13,8 +13,8 @@ from django.db import models from django.http.response import Http404 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 @@ -23,7 +23,6 @@ from django.views.generic.list import MultipleObjectMixin from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display from sapl.utils import normalize - logger = logging.getLogger(__name__) ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \ diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index f2e2f113a..db5160361 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -27,6 +27,7 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, Numeracao, Proposicao, Relatoria, TipoMateriaLegislativa, Tramitacao, UnidadeTramitacao) + def ANO_CHOICES(): return [('', '---------')] + RANGE_ANOS diff --git a/sapl/materia/views.py b/sapl/materia/views.py index a1638acfe..02e9d030b 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -24,7 +24,7 @@ from django.views.generic import CreateView, ListView, TemplateView, UpdateView from django.views.generic.base import RedirectView from django_filters.views import FilterView -from sapl.base.models import CasaLegislativa, AppConfig +from sapl.base.models import AppConfig, CasaLegislativa from sapl.compilacao.views import IntegracaoTaView from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.crud.base import (ACTION_CREATE, ACTION_DELETE, ACTION_DETAIL, @@ -53,7 +53,6 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, Tramitacao, UnidadeTramitacao) - OrigemCrud = Crud.build(Origem, '') TipoMateriaCrud = CrudAux.build( diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 19aba74e3..13fe9fc8c 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -13,7 +13,6 @@ from sapl.norma.forms import NormaJuridicaForm from .forms import NormaJuridicaPesquisaForm from .models import AssuntoNorma, NormaJuridica, TipoNormaJuridica - # LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '') AssuntoNormaCrud = CrudAux.build(AssuntoNorma, 'assunto_norma_juridica', list_field_names=['assunto', 'descricao']) diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 1121b1397..c1c258690 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -29,8 +29,7 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .models import (Autor, DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, StatusTramitacaoAdministrativo, - TipoDocumentoAdministrativo, - TramitacaoAdministrativo) + TipoDocumentoAdministrativo, TramitacaoAdministrativo) TipoDocumentoAdministrativoCrud = CrudAux.build( TipoDocumentoAdministrativo, '') diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 95af75b77..5c1d26d8c 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -1,7 +1,7 @@ from datetime import datetime from bs4 import BeautifulSoup -from django.http import HttpResponse, Http404 +from django.http import Http404, HttpResponse from django.utils.translation import ugettext_lazy as _ from sapl.base.models import CasaLegislativa diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index ac11a2fee..b8a6da598 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -46,7 +46,6 @@ from .models import (Bancada, Bloco, CargoBancada, CargoMesa, SessaoPlenariaPresenca, TipoExpediente, TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) - TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') TipoExpedienteCrud = CrudAux.build(TipoExpediente, 'tipo_expediente') CargoBancadaCrud = CrudAux.build(CargoBancada, '') diff --git a/sapl/test_general.py b/sapl/test_general.py index baaaf18d6..da2e17ae6 100644 --- a/sapl/test_general.py +++ b/sapl/test_general.py @@ -1,7 +1,8 @@ +import pytest from django.apps import apps from django.db.models import CharField, TextField from model_mommy import mommy -import pytest + from .settings import SAPL_APPS pytestmark = pytest.mark.django_db diff --git a/sapl/test_urls.py b/sapl/test_urls.py index d65747c89..9b97a6e12 100644 --- a/sapl/test_urls.py +++ b/sapl/test_urls.py @@ -1,3 +1,4 @@ +import pytest from django.apps import apps from django.contrib.auth import get_user_model from django.contrib.auth.management import _get_all_permissions @@ -7,18 +8,16 @@ from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.db.models import CharField, TextField from django.http.response import HttpResponseNotFound -from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import string_concat from model_mommy import mommy -import pytest -from sapl.crud.base import PermissionRequiredForAppCrudMixin, CrudAux +from sapl.crud.base import CrudAux, PermissionRequiredForAppCrudMixin from scripts.inicializa_grupos_autorizacoes import cria_grupos_permissoes from scripts.lista_urls import lista_urls from .settings import SAPL_APPS - pytestmark = pytest.mark.django_db sapl_appconfs = [apps.get_app_config(n[5:]) for n in SAPL_APPS]