diff --git a/sapl/api/forms.py b/sapl/api/forms.py index 5ac75f00f..fef0952c8 100644 --- a/sapl/api/forms.py +++ b/sapl/api/forms.py @@ -1,11 +1,9 @@ -from django.contrib.contenttypes.fields import GenericRel from django.db.models import Q from django_filters.filters import MethodFilter, ModelChoiceFilter from rest_framework.filters import FilterSet from sapl.base.forms import autores_models_generic_relations from sapl.base.models import Autor, TipoAutor -from sapl.utils import SaplGenericRelation class AutorChoiceFilterSet(FilterSet): @@ -31,7 +29,7 @@ class AutorChoiceFilterSet(FilterSet): order_by = [] for gr in autores_models_generic_relations(): - model = gr[0] + # model = gr[0] sgr = gr[1] for item in sgr: if item.related_model != Autor: diff --git a/sapl/api/pagination.py b/sapl/api/pagination.py index 75941c1d3..bb7096a55 100644 --- a/sapl/api/pagination.py +++ b/sapl/api/pagination.py @@ -1,5 +1,4 @@ from django.core.paginator import EmptyPage -from django.utils.encoding import force_text from rest_framework import pagination from rest_framework.response import Response diff --git a/sapl/api/serializers.py b/sapl/api/serializers.py index 1dc502450..44b6a44e6 100644 --- a/sapl/api/serializers.py +++ b/sapl/api/serializers.py @@ -1,8 +1,6 @@ -from django.contrib.contenttypes.fields import GenericRel from rest_framework import serializers from sapl.base.models import Autor -from sapl.utils import SaplGenericRelation class ChoiceSerializer(serializers.Serializer): diff --git a/sapl/api/urls.py b/sapl/api/urls.py index d87a5d48f..a23984ba7 100644 --- a/sapl/api/urls.py +++ b/sapl/api/urls.py @@ -1,11 +1,10 @@ from django.conf import settings -from django.conf.urls import url, include +from django.conf.urls import include, url from sapl.api.views import AutorListView from .apps import AppConfig - app_name = AppConfig.name diff --git a/sapl/api/views.py b/sapl/api/views.py index 4d5ee0ca8..e33807454 100644 --- a/sapl/api/views.py +++ b/sapl/api/views.py @@ -1,14 +1,13 @@ - from django.db.models import Q from django.http import Http404 from django.utils.translation import ugettext_lazy as _ from rest_framework.filters import DjangoFilterBackend from rest_framework.generics import ListAPIView -from rest_framework.permissions import IsAuthenticated, AllowAny +from rest_framework.permissions import AllowAny, IsAuthenticated from sapl.api.forms import AutorChoiceFilterSet -from sapl.api.serializers import ChoiceSerializer, AutorSerializer,\ - AutorChoiceSerializer +from sapl.api.serializers import (AutorChoiceSerializer, AutorSerializer, + ChoiceSerializer) from sapl.base.models import Autor, TipoAutor from sapl.utils import SaplGenericRelation, sapl_logger @@ -32,7 +31,7 @@ class AutorListView(ListAPIView): em combobox, radiobox, checkbox, etc com pesquisa básica de Autores mas feito para Possíveis Autores armazenados segundo o ContentType associado ao Tipo de Autor via - relacionamento genérico. + relacionamento genérico. Busca feita sem django-filter processada no get_queryset -> processo no cadastro de autores para seleção e busca dos possíveis autores @@ -44,7 +43,7 @@ class AutorListView(ListAPIView): - q - busca textual no nome do Autor ou em fields_search declarados no field SaplGenericRelation das GenericFks - A busca textual acontece via django-filter com a + A busca textual acontece via django-filter com a variável `tr` igual 1 ou 3. Em caso contrário, o django-filter é desativado e a busca é feita no model do ContentType associado ao tipo. diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 08bf8963d..4fcfc4ef7 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1,7 +1,7 @@ +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 -from crispy_forms.templatetags.crispy_forms_field import css_class from django import forms from django.conf import settings from django.contrib.auth import get_user_model @@ -13,8 +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 ugettext_lazy as _, string_concat -import django_filters +from django.utils.translation import ugettext_lazy as _ +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, @@ -23,12 +23,11 @@ from sapl.materia.models import MateriaLegislativa from sapl.sessao.models import SessaoPlenaria from sapl.settings import MAX_IMAGE_UPLOAD_SIZE from sapl.utils import (RANGE_ANOS, ImageThumbnailFileInput, - RangeWidgetOverride, autor_label, autor_modal, - SaplGenericRelation) + RangeWidgetOverride, SaplGenericRelation, autor_label, + autor_modal) from .models import AppConfig, CasaLegislativa - ACTION_CREATE_USERS_AUTOR_CHOICE = [ ('C', _('Criar novo Usuário')), ('A', _('Associar um usuário existente')), @@ -181,7 +180,8 @@ class AutorForm(ModelForm): autor_select = Row(to_column(('tipo', 3)), Div(to_column(('nome', 5)), - to_column(('cargo', 4)), css_class="div_nome_cargo"), + to_column(('cargo', 4)), + css_class="div_nome_cargo"), to_column((autor_related, 9)), to_column((Div( Field('autor_related'), diff --git a/sapl/base/templatetags/menus.py b/sapl/base/templatetags/menus.py index 3d208e86b..6e8b4f4a3 100644 --- a/sapl/base/templatetags/menus.py +++ b/sapl/base/templatetags/menus.py @@ -1,11 +1,10 @@ +import yaml from django import template from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ -import yaml from sapl.utils import sapl_logger - register = template.Library() diff --git a/sapl/base/urls.py b/sapl/base/urls.py index 4fbda888b..c2a9fdc4a 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -3,7 +3,7 @@ from django.contrib.auth import views from django.contrib.auth.decorators import permission_required from django.views.generic.base import TemplateView -from sapl.base.views import AutorCrud, TipoAutorCrud, ConfirmarEmailView +from sapl.base.views import AutorCrud, ConfirmarEmailView, TipoAutorCrud from .apps import AppConfig from .forms import LoginForm diff --git a/sapl/base/views.py b/sapl/base/views.py index 3d43d672e..8f0b426aa 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -9,12 +9,12 @@ from django.core.urlresolvers import reverse from django.db.models import Count, Q from django.http import HttpResponseRedirect from django.utils.encoding import force_bytes -from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode +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 sapl.base.forms import AutorForm, TipoAutorForm, AutorFormForAdmin +from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm from sapl.base.models import Autor, TipoAutor from sapl.crud.base import CrudAux from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py index fc679d611..0f767cbea 100644 --- a/sapl/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse from django.db.models import F from django.views.generic import ListView -from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, RP_DETAIL, RP_LIST +from sapl.crud.base import RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud from sapl.materia.models import MateriaLegislativa, Tramitacao from .models import (CargoComissao, Comissao, Composicao, Participacao, diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py index ccafcb6c2..9b7f79d95 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 @@ -20,8 +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 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, @@ -49,7 +49,6 @@ from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED, from sapl.crud.base import Crud, CrudListView, make_pagination from sapl.settings import BASE_DIR - 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 694898115..55366bcc5 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -14,8 +14,8 @@ from django.db.models.fields.related import ForeignKey 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 @@ -25,7 +25,6 @@ from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display 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 = \ @@ -1287,7 +1286,7 @@ class MasterDetailCrud(Crud): if hasattr(obj, 'parent_field'): parent_field = obj.parent_field.split('__') if not obj.is_m2m or len(parent_field) > 1: - field = self.model._meta.get_field(parent_field[0]) + # field = self.model._meta.get_field(parent_field[0]) if isinstance(getattr( self.object, parent_field[0]), models.Model): diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 26f14a64b..2a7f5bb92 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1,5 +1,6 @@ from datetime import datetime +import django_filters from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout from django import forms @@ -8,7 +9,6 @@ from django.db import models from django.db.models import Max from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import django_filters from sapl.base.models import Autor from sapl.comissoes.models import Comissao @@ -20,10 +20,10 @@ from sapl.settings import MAX_DOC_UPLOAD_SIZE from sapl.utils import (RANGE_ANOS, RangeWidgetOverride, autor_label, autor_modal) -from .models import (AcompanhamentoMateria, Anexada, Autoria, - DespachoInicial, DocumentoAcessorio, MateriaLegislativa, - Numeracao, Proposicao, Relatoria, TipoMateriaLegislativa, - Tramitacao, UnidadeTramitacao) +from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, + DocumentoAcessorio, MateriaLegislativa, Numeracao, + Proposicao, Relatoria, TipoMateriaLegislativa, Tramitacao, + UnidadeTramitacao) def ANO_CHOICES(): diff --git a/sapl/materia/models.py b/sapl/materia/models.py index e326b7698..be92e9063 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -7,10 +7,8 @@ from sapl.base.models import Autor from sapl.comissoes.models import Comissao from sapl.parlamentares.models import Parlamentar from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, - get_settings_auth_user_model, restringe_tipos_de_arquivo_txt) - EM_TRAMITACAO = [(1, 'Sim'), (0, 'Não')] diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index ed6ae1ccd..db5dd7684 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -1,10 +1,10 @@ +import pytest from django.contrib.auth import get_user_model 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 TipoAutor, Autor +from sapl.base.models import Autor, TipoAutor from sapl.comissoes.models import Comissao, TipoComissao from sapl.materia.models import (Anexada, Autoria, DespachoInicial, DocumentoAcessorio, MateriaLegislativa, diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index 5400978c6..c78796569 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -3,9 +3,8 @@ from django.conf.urls import include, url from sapl.materia.views import (AcompanhamentoConfirmarView, AcompanhamentoExcluirView, AcompanhamentoMateriaView, AnexadaCrud, - AutoriaCrud, - ConfirmarProposicao, DespachoInicialCrud, - DocumentoAcessorioCrud, + AutoriaCrud, ConfirmarProposicao, + DespachoInicialCrud, DocumentoAcessorioCrud, DocumentoAcessorioEmLoteView, LegislacaoCitadaCrud, MateriaLegislativaCrud, MateriaLegislativaPesquisaView, MateriaTaView, diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 7cd83a2ea..a85bdeb5f 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -5,7 +5,6 @@ from string import ascii_letters, digits from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML from django.contrib import messages -from django.contrib.auth import get_user_model from django.contrib.auth.mixins import PermissionRequiredMixin from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.core.mail import send_mail @@ -15,7 +14,6 @@ from django.http import JsonResponse from django.http.response import HttpResponseRedirect from django.shortcuts import redirect from django.template import Context, loader -from django.utils.http import urlsafe_base64_decode from django.utils.translation import ugettext_lazy as _ from django.views.generic import CreateView, ListView, TemplateView, UpdateView from django.views.generic.base import RedirectView @@ -33,10 +31,9 @@ from sapl.materia.forms import AnexadaForm, LegislacaoCitadaForm from sapl.norma.models import LegislacaoCitada from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, autor_modal, gerar_hash_arquivo, get_base_url, + montar_row_autor, permission_required_for_app, permissoes_autor, permissoes_materia, - permissoes_protocoloadm, permission_required_for_app, - montar_row_autor) - + permissoes_protocoloadm) from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, ConfirmarProposicaoForm, DocumentoAcessorioForm, diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index d31e4557d..4e937bd54 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -12,9 +12,8 @@ from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux, from sapl.materia.models import Proposicao, Relatoria from sapl.parlamentares.apps import AppConfig -from .forms import (FiliacaoForm, LegislaturaCreateForm, - LegislaturaUpdateForm, ParlamentarCreateForm, - ParlamentarForm) +from .forms import (FiliacaoForm, LegislaturaCreateForm, LegislaturaUpdateForm, + ParlamentarCreateForm, ParlamentarForm) from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, Dependente, Filiacao, Frente, Legislatura, Mandato, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 7eae4909d..549cdc498 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,7 +9,6 @@ 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 from sapl.crispy_layout_mixin import form_actions, to_row @@ -20,7 +20,6 @@ from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, TipoDocumentoAdministrativo, TramitacaoAdministrativo) - TIPOS_PROTOCOLO = [('0', 'Enviado'), ('1', 'Recebido'), ('', 'Ambos')] NATUREZA_PROCESSO = [('', 'Ambos'), diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py index 5f713202b..4ec3393ed 100644 --- a/sapl/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -5,8 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from model_utils import Choices from sapl.base.models import Autor -from sapl.materia.models import (TipoMateriaLegislativa, - UnidadeTramitacao) +from sapl.materia.models import TipoMateriaLegislativa, UnidadeTramitacao from sapl.utils import RANGE_ANOS, YES_NO_CHOICES diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 30a9606fa..8a52c1e38 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -1,13 +1,11 @@ from datetime import date, datetime -import json from braces.views import FormValidMessageMixin from django.contrib import messages from django.contrib.auth.mixins import PermissionRequiredMixin -from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse -from django.db.models import Max, Q -from django.http import HttpResponse, HttpResponseRedirect +from django.db.models import Max +from django.http import HttpResponseRedirect from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ from django.views.generic import CreateView, DetailView, FormView, ListView @@ -15,7 +13,7 @@ from django.views.generic.base import TemplateView from django_filters.views import FilterView from sapl.base.apps import AppConfig as AppsAppConfig -from sapl.base.models import AppConfig, Autor +from sapl.base.models import AppConfig from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination from sapl.materia.models import TipoMateriaLegislativa from sapl.utils import (create_barcode, get_client_ip, permissoes_adm, @@ -26,12 +24,10 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, DocumentoAdministrativoForm, ProtocoloDocumentForm, ProtocoloFilterSet, ProtocoloMateriaForm, TramitacaoAdmEditForm, TramitacaoAdmForm) -from .models import (DocumentoAcessorioAdministrativo, - DocumentoAdministrativo, Protocolo, - StatusTramitacaoAdministrativo, +from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, + Protocolo, StatusTramitacaoAdministrativo, TipoDocumentoAdministrativo, TramitacaoAdministrativo) - TipoDocumentoAdministrativoCrud = CrudAux.build( TipoDocumentoAdministrativo, '') @@ -634,4 +630,4 @@ def pesquisa_autores(request): sort_keys=True, ensure_ascii=False), content_type="application/json; charset=utf-8") -""" \ No newline at end of file +""" diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 6c3184b42..82fd7edf7 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -4,7 +4,7 @@ from bs4 import BeautifulSoup from django.http import Http404, HttpResponse from django.utils.translation import ugettext_lazy as _ -from sapl.base.models import CasaLegislativa, Autor +from sapl.base.models import Autor, CasaLegislativa from sapl.comissoes.models import Comissao from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao, Tramitacao, UnidadeTramitacao) diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index dc375fff7..cf74399b5 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -6,8 +6,8 @@ from sapl.base.models import Autor from sapl.materia.models import MateriaLegislativa from sapl.parlamentares.models import (CargoMesa, Legislatura, Parlamentar, Partido, SessaoLegislativa) -from sapl.utils import YES_NO_CHOICES, restringe_tipos_de_arquivo_txt,\ - SaplGenericRelation +from sapl.utils import (YES_NO_CHOICES, SaplGenericRelation, + restringe_tipos_de_arquivo_txt) class CargoBancada(models.Model): diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 3f8fe93af..fbd044b51 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -45,7 +45,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/settings.py b/sapl/settings.py index f3030d255..7f39005b4 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -23,7 +23,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) @@ -98,7 +97,7 @@ MIDDLEWARE_CLASSES = ( REST_FRAMEWORK = { "DEFAULT_RENDERER_CLASSES": ( "rest_framework.renderers.JSONRenderer", - #"rest_framework.renderers.BrowsableAPIRenderer", + # "rest_framework.renderers.BrowsableAPIRenderer", ), "DEFAULT_PARSER_CLASSES": ( "rest_framework.parsers.JSONParser", diff --git a/sapl/test_urls.py b/sapl/test_urls.py index 02be7505c..51c6f5e2e 100644 --- a/sapl/test_urls.py +++ b/sapl/test_urls.py @@ -1,22 +1,19 @@ +import pytest from django.apps import apps from django.contrib.auth import get_user_model from django.contrib.auth.management import _get_all_permissions from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db import transaction -from django.utils.translation import string_concat -from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ -import pytest +from django.utils.translation import string_concat from sapl.crud.base import PermissionRequiredForAppCrudMixin -from sapl.materia.views import recuperar_materia 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] diff --git a/sapl/utils.py b/sapl/utils.py index 7029a508b..b4e6450fa 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -1,9 +1,10 @@ +import hashlib +import logging from datetime import date from functools import wraps from unicodedata import normalize as unicodedata_normalize -import hashlib -import logging +import magic from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button from django import forms @@ -17,11 +18,10 @@ from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied, ValidationError from django.utils.translation import ugettext_lazy as _ from floppyforms import ClearableFileInput + from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row -import magic from sapl.settings import BASE_DIR - sapl_logger = logging.getLogger(BASE_DIR.name) @@ -121,8 +121,10 @@ class SaplGenericRelation(GenericRelation): ) - [ref_1]: https://docs.djangoproject.com/el/1.10/topics/db/queries/#field-lookups - [ref_2]: https://github.com/interlegis/sapl/blob/master/sapl/parlamentares/models.py + [ref_1]: https://docs.djangoproject.com/el/1.10/topics/db/queries/ + #field-lookups + [ref_2]: https://github.com/interlegis/sapl/blob/master/sapl/ + parlamentares/models.py """ def __init__(self, to, fields_search=(), **kwargs): @@ -136,7 +138,7 @@ class SaplGenericRelation(GenericRelation): for field in fields_search: # descomente para ver todas os campos que são elementos de busca - #print(kwargs['related_query_name'], field) + # print(kwargs['related_query_name'], field) assert isinstance(field, (tuple, list)), _( 'fields_search deve ser um array de tuplas ou listas.') diff --git a/scripts/inicializa_grupos_autorizacoes.py b/scripts/inicializa_grupos_autorizacoes.py index fe69914b1..38606b0a3 100644 --- a/scripts/inicializa_grupos_autorizacoes.py +++ b/scripts/inicializa_grupos_autorizacoes.py @@ -10,7 +10,6 @@ if True: from django.contrib.auth import get_user_model from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType - from sapl.base.models import Autor class InicializaGruposAutorizacoes():