diff --git a/create_admin.py b/create_admin.py
index 6080fbd07..bc8aa09e9 100644
--- a/create_admin.py
+++ b/create_admin.py
@@ -35,6 +35,7 @@ def create_superuser():
sys.exit(0)
+
if __name__ == '__main__':
django.setup()
create_superuser()
diff --git a/genkey.py b/genkey.py
index 207989e92..4bf92f1ac 100644
--- a/genkey.py
+++ b/genkey.py
@@ -6,5 +6,6 @@ def generate_secret():
'abcdefghijklmnopqrst'
'uvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]))
+
if __name__ == '__main__':
print(generate_secret())
diff --git a/sapl/api/forms.py b/sapl/api/forms.py
index 94bc80de4..2ee441d34 100644
--- a/sapl/api/forms.py
+++ b/sapl/api/forms.py
@@ -7,7 +7,6 @@ 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
-
from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura
from sapl.utils import generic_relations_for_model
diff --git a/sapl/api/serializers.py b/sapl/api/serializers.py
index 9219bf0e4..9e08ea991 100644
--- a/sapl/api/serializers.py
+++ b/sapl/api/serializers.py
@@ -1,5 +1,4 @@
from rest_framework import serializers
-
from sapl.base.models import Autor, CasaLegislativa
from sapl.materia.models import MateriaLegislativa
from sapl.sessao.models import OrdemDia, SessaoPlenaria
diff --git a/sapl/api/urls.py b/sapl/api/urls.py
index 1f19e9d1f..005a71f5c 100644
--- a/sapl/api/urls.py
+++ b/sapl/api/urls.py
@@ -1,7 +1,6 @@
from django.conf import settings
from django.conf.urls import include, url
from rest_framework.routers import DefaultRouter
-
from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView,
AutorListView, MateriaLegislativaViewSet,
ModelChoiceView, SessaoPlenariaViewSet)
diff --git a/sapl/api/views.py b/sapl/api/views.py
index 9853e6af0..2adffa7e5 100644
--- a/sapl/api/views.py
+++ b/sapl/api/views.py
@@ -8,7 +8,6 @@ from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.permissions import (AllowAny, IsAuthenticated,
IsAuthenticatedOrReadOnly)
from rest_framework.viewsets import GenericViewSet
-
from sapl.api.forms import (AutorChoiceFilterSet, AutoresPossiveisFilterSet,
AutorSearchForFieldFilterSet)
from sapl.api.serializers import (AutorChoiceSerializer, AutorSerializer,
diff --git a/sapl/base/admin.py b/sapl/base/admin.py
index 941faf8d1..00f9e104b 100644
--- a/sapl/base/admin.py
+++ b/sapl/base/admin.py
@@ -3,7 +3,6 @@ from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from reversion.models import Revision
-
from sapl.base.models import ProblemaMigracao
from sapl.utils import register_all_models_in_admin
@@ -41,4 +40,5 @@ class RevisionAdmin(admin.ModelAdmin):
self.message_user(request, _('You cannot change history.'))
return redirect('admin:reversion_revision_changelist')
+
admin.site.register(Revision, RevisionAdmin)
diff --git a/sapl/base/forms.py b/sapl/base/forms.py
index 23c919ae0..d7982352f 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
@@ -9,12 +10,9 @@ from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm,
from django.contrib.auth.models import Group, User
from django.core.exceptions import ValidationError
from django.db import models, transaction
-from django.forms import ModelForm, Form
-from django.utils.translation import string_concat
+from django.forms import Form, ModelForm
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,
to_row)
@@ -28,7 +26,6 @@ from sapl.utils import (RANGE_ANOS, ChoiceWithoutValidationField,
from .models import AppConfig, CasaLegislativa
-
ACTION_CREATE_USERS_AUTOR_CHOICE = [
('A', _('Associar um usuário existente')),
('N', _('Autor sem Usuário de Acesso ao Sapl')),
@@ -728,7 +725,6 @@ class AlterarSenhaForm(Form):
max_length=50,
widget=forms.PasswordInput())
-
class Meta:
fields = ['username', 'old_password', 'new_password1', 'new_password2']
@@ -779,4 +775,4 @@ class AlterarSenhaForm(Form):
if user.check_password(new_password1):
raise ValidationError("Nova senha não pode ser igual à senha anterior")
- return self.cleaned_data
\ No newline at end of file
+ return self.cleaned_data
diff --git a/sapl/base/models.py b/sapl/base/models.py
index a783dcfa0..747fbc856 100644
--- a/sapl/base/models.py
+++ b/sapl/base/models.py
@@ -5,7 +5,6 @@ from django.db import models
from django.db.models.signals import post_migrate
from django.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import ugettext_lazy as _
-
from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES,
get_settings_auth_user_model, models_with_gr_for_model)
diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py
index 9c11f304f..3deb42eac 100644
--- a/sapl/base/search_indexes.py
+++ b/sapl/base/search_indexes.py
@@ -3,7 +3,8 @@ import os.path
import re
import string
-from django.db.models import Q, F, Value
+import textract
+from django.db.models import F, Q, Value
from django.db.models.fields import TextField
from django.db.models.fields.files import FieldFile
from django.db.models.functions import Concat
@@ -12,15 +13,13 @@ from haystack.constants import Indexable
from haystack.fields import CharField
from haystack.indexes import SearchIndex
from haystack.utils import get_model_ct_tuple
-from textract.exceptions import ExtensionNotSupported
-import textract
-
-from sapl.compilacao.models import TextoArticulado, Dispositivo,\
- STATUS_TA_PUBLIC, STATUS_TA_IMMUTABLE_PUBLIC
+from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
+ STATUS_TA_PUBLIC, Dispositivo,
+ TextoArticulado)
from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa
from sapl.norma.models import NormaJuridica
from sapl.settings import BASE_DIR, SOLR_URL
-
+from textract.exceptions import ExtensionNotSupported
logger = logging.getLogger(BASE_DIR.name)
diff --git a/sapl/base/templatetags/base_tags.py b/sapl/base/templatetags/base_tags.py
index 22f0aa4b1..1583cd75f 100644
--- a/sapl/base/templatetags/base_tags.py
+++ b/sapl/base/templatetags/base_tags.py
@@ -6,4 +6,4 @@ register = template.Library()
@register.filter
def tipoautor_contenttype_list(tipo):
- return 'sapl.'+tipo.content_type.app_label+':'+tipo.content_type.model+'_list'
+ return 'sapl.' + tipo.content_type.app_label + ':' + tipo.content_type.model + '_list'
diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py
index ca8e3c40e..2e24b8cc2 100644
--- a/sapl/base/templatetags/common_tags.py
+++ b/sapl/base/templatetags/common_tags.py
@@ -1,6 +1,5 @@
from compressor.utils import get_class
from django import template
-
from sapl.base.models import AppConfig
from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa
from sapl.norma.models import NormaJuridica
diff --git a/sapl/base/templatetags/menus.py b/sapl/base/templatetags/menus.py
index d15368553..fdfbbf57a 100644
--- a/sapl/base/templatetags/menus.py
+++ b/sapl/base/templatetags/menus.py
@@ -1,8 +1,8 @@
import yaml
+
from django import template
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
-
from sapl.utils import sapl_logger
register = template.Library()
diff --git a/sapl/base/tests/test_form.py b/sapl/base/tests/test_form.py
index 35f1c82bf..fcaecdaaf 100644
--- a/sapl/base/tests/test_form.py
+++ b/sapl/base/tests/test_form.py
@@ -1,6 +1,5 @@
import pytest
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.forms import CasaLegislativaForm
diff --git a/sapl/base/tests/teststub_urls.py b/sapl/base/tests/teststub_urls.py
index 9796768f2..3d85e2d9b 100644
--- a/sapl/base/tests/teststub_urls.py
+++ b/sapl/base/tests/teststub_urls.py
@@ -1,6 +1,5 @@
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
-
from sapl.urls import urlpatterns as original_patterns
ptrn = patterns('',
diff --git a/sapl/base/urls.py b/sapl/base/urls.py
index 88c423f52..143a89ba8 100644
--- a/sapl/base/urls.py
+++ b/sapl/base/urls.py
@@ -5,18 +5,18 @@ from django.contrib.auth.views import (password_reset, password_reset_complete,
password_reset_confirm,
password_reset_done)
from django.views.generic.base import TemplateView
-
from sapl.base.views import AutorCrud, ConfirmarEmailView, TipoAutorCrud
from sapl.settings import EMAIL_SEND_USER
from .apps import AppConfig
from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm
-from .views import (AppConfigCrud, CasaLegislativaCrud, HelpTopicView,
- RelatorioAtasView, RelatorioHistoricoTramitacaoView,
+from .views import (AlterarSenha, AppConfigCrud, CasaLegislativaCrud,
+ HelpTopicView, RelatorioAtasView,
+ RelatorioHistoricoTramitacaoView,
RelatorioMateriasPorAnoAutorTipoView,
RelatorioMateriasPorAutorView,
RelatorioMateriasTramitacaoView,
- RelatorioPresencaSessaoView, SaplSearchView, AlterarSenha)
+ RelatorioPresencaSessaoView, SaplSearchView)
app_name = AppConfig.name
diff --git a/sapl/base/views.py b/sapl/base/views.py
index 700b0a30a..f31ed1c58 100644
--- a/sapl/base/views.py
+++ b/sapl/base/views.py
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.contrib.auth import get_user_model
+from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth.models import Group
from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
@@ -11,12 +11,12 @@ from django.template import TemplateDoesNotExist
from django.template.loader import get_template
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
-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 import FormView
from django.views.generic.base import TemplateView
from django_filters.views import FilterView
from haystack.views import SearchView
-from django.views.generic import FormView
-from django.contrib.auth import update_session_auth_hash
from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm
from sapl.base.models import Autor, TipoAutor
from sapl.crud.base import CrudAux
@@ -27,13 +27,13 @@ from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria,
from sapl.utils import (parlamentares_ativos, sapl_logger,
show_results_filter_set)
-from .forms import (CasaLegislativaForm, ConfiguracoesAppForm,
- RelatorioAtasFilterSet,
+from .forms import (AlterarSenhaForm, CasaLegislativaForm,
+ ConfiguracoesAppForm, RelatorioAtasFilterSet,
RelatorioHistoricoTramitacaoFilterSet,
RelatorioMateriasPorAnoAutorTipoFilterSet,
RelatorioMateriasPorAutorFilterSet,
RelatorioMateriasTramitacaoilterSet,
- RelatorioPresencaSessaoFilterSet, AlterarSenhaForm)
+ RelatorioPresencaSessaoFilterSet)
from .models import AppConfig, CasaLegislativa
@@ -625,4 +625,4 @@ class AlterarSenha(FormView):
user.set_password(new_password)
user.save()
- return super().form_valid(form)
\ No newline at end of file
+ return super().form_valid(form)
diff --git a/sapl/comissoes/forms.py b/sapl/comissoes/forms.py
index a697001af..2ce7dcfaa 100644
--- a/sapl/comissoes/forms.py
+++ b/sapl/comissoes/forms.py
@@ -1,17 +1,17 @@
-from django.db.models import Q
from django import forms
-from django.core.exceptions import ValidationError
from django.contrib.contenttypes.models import ContentType
+from django.core.exceptions import ValidationError
from django.db import transaction
+from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import Autor, TipoAutor
-from sapl.comissoes.models import Participacao, Composicao, Comissao
-from sapl.parlamentares.models import Parlamentar, Legislatura, Mandato
+from sapl.comissoes.models import Comissao, Composicao, Participacao
+from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar
+
class ParticipacaoCreateForm(forms.ModelForm):
- parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
+ parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
class Meta:
model = Participacao
@@ -34,14 +34,14 @@ class ParticipacaoCreateForm(forms.ModelForm):
parlamentares = Mandato.objects.filter(qs,
parlamentar__ativo=True
).prefetch_related('parlamentar').\
- values_list('parlamentar',
- flat=True).distinct()
+ values_list('parlamentar',
+ flat=True).distinct()
qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\
- exclude(id__in=id_part)
+ exclude(id__in=id_part)
eligible = self.verifica()
result = list(set(qs) & set(eligible))
- if not cmp(result, eligible): # se igual a 0 significa que o qs e o eli são iguais!
+ if not cmp(result, eligible): # se igual a 0 significa que o qs e o eli são iguais!
self.fields['parlamentar'].queryset = qs
else:
ids = [e.id for e in eligible]
@@ -55,7 +55,7 @@ class ParticipacaoCreateForm(forms.ModelForm):
q1 = Q(data_fim_mandato__isnull=False,
data_fim_mandato__gte=data_inicio_comissao)
q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \
- & Q(data_inicio_mandato__lte=data_fim_comissao)
+ & Q(data_inicio_mandato__lte=data_fim_comissao)
q3 = Q(data_fim_mandato__isnull=True,
data_inicio_mandato__lte=data_inicio_comissao)
qs = q1 | q2 | q3
@@ -82,17 +82,18 @@ class ParticipacaoCreateForm(forms.ModelForm):
comp_data_inicio = composicao.periodo.data_inicio
comp_data_fim = composicao.periodo.data_fim
if (data_fim and data_fim >= comp_data_inicio)\
- or (data_inicio >= comp_data_inicio and data_inicio <= comp_data_fim)\
- or (data_fim is None and data_inicio <= comp_data_inicio):
+ or (data_inicio >= comp_data_inicio and data_inicio <= comp_data_fim)\
+ or (data_fim is None and data_inicio <= comp_data_inicio):
lista.append(p)
lista = list(set(lista))
return lista
+
class ParticipacaoEditForm(forms.ModelForm):
- parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
+ parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
nome_parlamentar = forms.CharField(required=False, label='Parlamentar')
class Meta:
@@ -111,8 +112,6 @@ class ParticipacaoEditForm(forms.ModelForm):
self.fields['nome_parlamentar'].widget.attrs['disabled'] = 'disabled'
-
-
class ComissaoForm(forms.ModelForm):
class Meta:
@@ -135,7 +134,7 @@ class ComissaoForm(forms.ModelForm):
content_type = ContentType.objects.get_for_model(Comissao)
object_id = comissao.pk
tipo = TipoAutor.objects.get(descricao__icontains='Comiss')
- nome = comissao.sigla+' - '+comissao.nome
+ nome = comissao.sigla + ' - ' + comissao.nome
Autor.objects.create(
content_type=content_type,
object_id=object_id,
diff --git a/sapl/comissoes/models.py b/sapl/comissoes/models.py
index df8cd6549..078097cab 100644
--- a/sapl/comissoes/models.py
+++ b/sapl/comissoes/models.py
@@ -3,7 +3,6 @@ import reversion
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
-
from sapl.base.models import Autor
from sapl.parlamentares.models import Parlamentar
from sapl.utils import YES_NO_CHOICES, SaplGenericRelation
diff --git a/sapl/comissoes/tests/test_comissoes.py b/sapl/comissoes/tests/test_comissoes.py
index fee303192..0b040b914 100644
--- a/sapl/comissoes/tests/test_comissoes.py
+++ b/sapl/comissoes/tests/test_comissoes.py
@@ -1,7 +1,6 @@
import pytest
from django.core.urlresolvers import reverse
from model_mommy import mommy
-
from sapl.comissoes.models import Comissao, Composicao, Periodo, TipoComissao
from sapl.parlamentares.models import Filiacao, Parlamentar, Partido
diff --git a/sapl/comissoes/urls.py b/sapl/comissoes/urls.py
index c76fba2b6..128cb7647 100644
--- a/sapl/comissoes/urls.py
+++ b/sapl/comissoes/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud,
MateriasTramitacaoListView, ParticipacaoCrud,
PeriodoComposicaoCrud, TipoComissaoCrud)
diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py
index 6c9b0b3b2..eb32b977a 100644
--- a/sapl/comissoes/views.py
+++ b/sapl/comissoes/views.py
@@ -3,7 +3,6 @@ from django.core.urlresolvers import reverse
from django.db.models import F
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import ListView
-
from sapl.comissoes.forms import ParticipacaoCreateForm, ParticipacaoEditForm
from sapl.crud.base import RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud
from sapl.materia.models import MateriaLegislativa, Tramitacao
@@ -19,6 +18,7 @@ def pegar_url_composicao(pk):
url = reverse('sapl.comissoes:composicao_detail', kwargs={'pk': comp_pk})
return url
+
CargoCrud = CrudAux.build(CargoComissao, 'cargo_comissao')
PeriodoComposicaoCrud = CrudAux.build(Periodo, 'periodo_composicao_comissao')
@@ -58,7 +58,6 @@ class ParticipacaoCrud(MasterDetailCrud):
)
-
class ComposicaoCrud(MasterDetailCrud):
model = Composicao
parent_field = 'comissao'
@@ -111,6 +110,7 @@ class ComissaoCrud(Crud):
def form_valid(self, form):
return super(Crud.CreateView, self).form_valid(form)
+
class MateriasTramitacaoListView(ListView):
template_name = "comissoes/materias_em_tramitacao.html"
paginate_by = 10
diff --git a/sapl/compilacao/forms.py b/sapl/compilacao/forms.py
index f51504f2c..0748b1423 100644
--- a/sapl/compilacao/forms.py
+++ b/sapl/compilacao/forms.py
@@ -14,7 +14,6 @@ from django.forms.forms import Form
from django.forms.models import ModelForm
from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _
-
from sapl import utils
from sapl.compilacao.models import (NOTAS_PUBLICIDADE_CHOICES,
PARTICIPACAO_SOCIAL_CHOICES, Dispositivo,
diff --git a/sapl/compilacao/models.py b/sapl/compilacao/models.py
index e4be0762b..d925c2cc8 100644
--- a/sapl/compilacao/models.py
+++ b/sapl/compilacao/models.py
@@ -1,4 +1,5 @@
+import reversion
from django.contrib import messages
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
@@ -12,8 +13,6 @@ from django.utils import timezone
from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
-import reversion
-
from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter,
int_to_roman)
from sapl.utils import YES_NO_CHOICES, get_settings_auth_user_model
diff --git a/sapl/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py
index e56478bae..58c6dfaec 100644
--- a/sapl/compilacao/templatetags/compilacao_filters.py
+++ b/sapl/compilacao/templatetags/compilacao_filters.py
@@ -4,7 +4,6 @@ from django.core.signing import Signer
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
-
from sapl.compilacao.models import Dispositivo
register = template.Library()
diff --git a/sapl/compilacao/tests/test_tipo_texto_articulado_form.py b/sapl/compilacao/tests/test_tipo_texto_articulado_form.py
index d9db055e3..84593650f 100644
--- a/sapl/compilacao/tests/test_tipo_texto_articulado_form.py
+++ b/sapl/compilacao/tests/test_tipo_texto_articulado_form.py
@@ -1,7 +1,6 @@
import pytest
from django.utils.translation import ugettext as _
from model_mommy import mommy
-
from sapl.compilacao import forms
from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota
from sapl.compilacao.views import choice_models_in_extenal_views
diff --git a/sapl/compilacao/urls.py b/sapl/compilacao/urls.py
index aaf8d3543..69b6fd654 100644
--- a/sapl/compilacao/urls.py
+++ b/sapl/compilacao/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.compilacao import views
from sapl.compilacao.views import (TipoDispositivoCrud, TipoNotaCrud,
TipoPublicacaoCrud, TipoVideCrud,
diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py
index 878c21b06..73a9994a9 100644
--- a/sapl/compilacao/views.py
+++ b/sapl/compilacao/views.py
@@ -1,7 +1,7 @@
-from collections import OrderedDict
-from datetime import timedelta
import logging
import sys
+from collections import OrderedDict
+from datetime import timedelta
from braces.views import FormMessagesMixin
from django import forms
@@ -19,14 +19,13 @@ from django.http.response import (HttpResponse, HttpResponseRedirect,
from django.shortcuts import get_object_or_404, redirect
from django.utils.dateparse import parse_date
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,
UpdateView)
from django.views.generic.list import ListView
-
from sapl.compilacao.forms import (DispositivoDefinidorVigenciaForm,
DispositivoEdicaoAlteracaoForm,
DispositivoEdicaoBasicaForm,
@@ -50,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/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py
index 0b8541a58..aa38f18d4 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, reverse_lazy
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 44852d7a0..c94820a03 100644
--- a/sapl/crud/base.py
+++ b/sapl/crud/base.py
@@ -17,20 +17,18 @@ 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
from django.views.generic.list import MultipleObjectMixin
-
from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display
from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL,
RP_LIST)
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/crud/tests/test_base.py b/sapl/crud/tests/test_base.py
index 8e1d10965..8a8a26af4 100644
--- a/sapl/crud/tests/test_base.py
+++ b/sapl/crud/tests/test_base.py
@@ -1,7 +1,6 @@
import pytest
from django.core.urlresolvers import reverse
from model_mommy import mommy
-
from sapl.crud.base import (CrispyLayoutFormMixin, CrudListView, from_to,
get_field_display, make_pagination)
from sapl.crud.tests.stub_app.models import Continent, Country
diff --git a/sapl/legacy/management/commands/migracao_25_31.py b/sapl/legacy/management/commands/migracao_25_31.py
index c0e2fa352..9e7f0a32a 100644
--- a/sapl/legacy/management/commands/migracao_25_31.py
+++ b/sapl/legacy/management/commands/migracao_25_31.py
@@ -1,6 +1,5 @@
from django.core import management
from django.core.management.base import BaseCommand
-
from sapl.legacy import migration
diff --git a/sapl/legacy/management/commands/migracao_documentos.py b/sapl/legacy/management/commands/migracao_documentos.py
index 7cba09d5a..f9e81a29c 100644
--- a/sapl/legacy/management/commands/migracao_documentos.py
+++ b/sapl/legacy/management/commands/migracao_documentos.py
@@ -1,5 +1,4 @@
from django.core.management.base import BaseCommand
-
from sapl.legacy.migracao_documentos import migrar_documentos
diff --git a/sapl/legacy/migracao_documentos.py b/sapl/legacy/migracao_documentos.py
index a31e02b50..d7b392f6a 100644
--- a/sapl/legacy/migracao_documentos.py
+++ b/sapl/legacy/migracao_documentos.py
@@ -2,9 +2,9 @@ import mimetypes
import os
import re
-import magic
import yaml
+import magic
from sapl.base.models import CasaLegislativa
from sapl.legacy.migration import exec_legado, warn
from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa,
diff --git a/sapl/legacy/migracao_usuarios.py b/sapl/legacy/migracao_usuarios.py
index 88fb77343..2bbee7423 100644
--- a/sapl/legacy/migracao_usuarios.py
+++ b/sapl/legacy/migracao_usuarios.py
@@ -1,5 +1,4 @@
from django.contrib.auth.models import Group, User
-
from sapl.settings import MEDIA_ROOT
PERFIL_LEGADO_PARA_NOVO = {legado: Group.objects.get(name=novo)
diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py
index 4ad65ffa9..aed35459b 100644
--- a/sapl/legacy/migration.py
+++ b/sapl/legacy/migration.py
@@ -5,8 +5,9 @@ from itertools import groupby
from subprocess import PIPE, call
import pkg_resources
-import reversion
import yaml
+
+import reversion
from django.apps import apps
from django.apps.config import AppConfig
from django.contrib.auth import get_user_model
@@ -16,7 +17,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.db import connections, transaction
from django.db.models import Count, Max
from django.db.models.base import ModelBase
-
from sapl.base.models import AppConfig as AppConf
from sapl.base.models import (Autor, ProblemaMigracao, TipoAutor,
cria_models_tipo_autor)
@@ -145,6 +145,7 @@ def exec_sql(sql, db='default'):
cursor.execute(sql)
return cursor
+
exec_legado = partial(exec_sql, db='legacy')
diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py
index d1dcc4736..1f234c49e 100755
--- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py
+++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py
@@ -12,6 +12,7 @@ from functools import partial
from os.path import splitext
import yaml
+
import ZODB.DB
import ZODB.FileStorage
from ZODB.broken import Broken
diff --git a/sapl/legacy/scripts/scrap_original_forms.py b/sapl/legacy/scripts/scrap_original_forms.py
index 57d280d87..fb6927cdc 100644
--- a/sapl/legacy/scripts/scrap_original_forms.py
+++ b/sapl/legacy/scripts/scrap_original_forms.py
@@ -7,8 +7,8 @@ import pkg_resources
import yaml
from bs4 import BeautifulSoup
from bs4.element import NavigableString, Tag
-from django.apps.config import AppConfig
+from django.apps.config import AppConfig
from sapl.crispy_layout_mixin import heads_and_tails
from sapl.legacy.migration import appconfs, get_renames
from sapl.legacy.scripts.utils import getsourcelines
diff --git a/sapl/legacy/scripts/study.py b/sapl/legacy/scripts/study.py
index 9049a9c06..a28428c7d 100644
--- a/sapl/legacy/scripts/study.py
+++ b/sapl/legacy/scripts/study.py
@@ -1,5 +1,4 @@
from django.apps import apps
-
from sapl.legacy.migration import legacy_app
for model in apps.get_app_config('legacy').get_models():
diff --git a/sapl/lexml/urls.py b/sapl/lexml/urls.py
index e7d582030..a10299ca0 100644
--- a/sapl/lexml/urls.py
+++ b/sapl/lexml/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud
from .apps import AppConfig
diff --git a/sapl/materia/admin.py b/sapl/materia/admin.py
index cd6292c9c..8da7408b1 100644
--- a/sapl/materia/admin.py
+++ b/sapl/materia/admin.py
@@ -1,5 +1,4 @@
from django.contrib import admin
-
from sapl.materia.models import Proposicao
from sapl.settings import DEBUG
from sapl.utils import register_all_models_in_admin
diff --git a/sapl/materia/apps.py b/sapl/materia/apps.py
index 883109d31..bb4f72f73 100644
--- a/sapl/materia/apps.py
+++ b/sapl/materia/apps.py
@@ -8,4 +8,4 @@ class AppConfig(apps.AppConfig):
verbose_name = _('Matéria')
def ready(self):
- from . import receivers
\ No newline at end of file
+ from . import receivers
diff --git a/sapl/materia/email_utils.py b/sapl/materia/email_utils.py
index 3dc6b220d..a28fcbc5f 100644
--- a/sapl/materia/email_utils.py
+++ b/sapl/materia/email_utils.py
@@ -4,7 +4,6 @@ from django.core.mail import EmailMultiAlternatives, get_connection, send_mail
from django.core.urlresolvers import reverse
from django.template import Context, loader
from django.utils import timezone
-
from sapl.base.models import CasaLegislativa
from sapl.settings import EMAIL_SEND_USER
diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py
index 97aaa3d59..a693c1a3f 100644
--- a/sapl/materia/forms.py
+++ b/sapl/materia/forms.py
@@ -1,6 +1,8 @@
import os
+import django_filters
+import sapl
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,
@@ -21,8 +23,6 @@ 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
-
from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import Comissao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
@@ -30,8 +30,8 @@ from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column,
to_row)
from sapl.materia.models import (AssuntoMateria, MateriaAssunto,
- MateriaLegislativa, RegimeTramitacao,
- TipoDocumento, TipoProposicao, Orgao)
+ MateriaLegislativa, Orgao, RegimeTramitacao,
+ TipoDocumento, TipoProposicao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica)
from sapl.protocoloadm.models import Protocolo
@@ -41,7 +41,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,
@@ -90,7 +89,7 @@ class OrgaoForm(ModelForm):
content_type = ContentType.objects.get_for_model(Orgao)
object_id = orgao.pk
tipo = TipoAutor.objects.get(descricao='Órgão')
- nome = orgao.nome+' - '+orgao.sigla
+ nome = orgao.nome + ' - ' + orgao.sigla
Autor.objects.create(
content_type=content_type,
object_id=object_id,
@@ -99,6 +98,7 @@ class OrgaoForm(ModelForm):
)
return orgao
+
class ReceberProposicaoForm(Form):
cod_hash = forms.CharField(label='Código do Documento', required=True)
diff --git a/sapl/materia/models.py b/sapl/materia/models.py
index f5f4bf269..899cca6de 100644
--- a/sapl/materia/models.py
+++ b/sapl/materia/models.py
@@ -9,7 +9,6 @@ from django.db.models.functions import Concat
from django.utils import formats, timezone
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
-
from sapl.base.models import Autor
from sapl.comissoes.models import Comissao
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado,
@@ -799,12 +798,13 @@ class UnidadeTramitacaoManager(models.Manager):
Esta classe permite ordenar alfabeticamente a unidade de tramitacao
através da concatenação de 3 fields
"""
+
def get_queryset(self):
return super(UnidadeTramitacaoManager, self).get_queryset().annotate(
- nome_composto=Concat('orgao__nome',
- 'comissao__sigla',
- 'parlamentar__nome_parlamentar')
- ).order_by('nome_composto')
+ nome_composto=Concat('orgao__nome',
+ 'comissao__sigla',
+ 'parlamentar__nome_parlamentar')
+ ).order_by('nome_composto')
@reversion.register()
diff --git a/sapl/materia/receivers.py b/sapl/materia/receivers.py
index 945c6636e..6e4ee737e 100644
--- a/sapl/materia/receivers.py
+++ b/sapl/materia/receivers.py
@@ -1,6 +1,5 @@
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
-
from sapl.materia.models import Tramitacao
from sapl.materia.signals import tramitacao_signal
from sapl.utils import get_base_url
diff --git a/sapl/materia/tests/test_email_templates.py b/sapl/materia/tests/test_email_templates.py
index aac13cbb7..35b5f4ef2 100644
--- a/sapl/materia/tests/test_email_templates.py
+++ b/sapl/materia/tests/test_email_templates.py
@@ -1,5 +1,4 @@
from django.core import mail
-
from sapl.materia.email_utils import enviar_emails, load_email_templates
diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py
index a538cfb87..bbeec1393 100644
--- a/sapl/materia/tests/test_materia.py
+++ b/sapl/materia/tests/test_materia.py
@@ -1,10 +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
from sapl.materia.models import (Anexada, Autoria, DespachoInicial,
diff --git a/sapl/materia/tests/test_materia_form.py b/sapl/materia/tests/test_materia_form.py
index 41ad04837..f94a6cb8d 100644
--- a/sapl/materia/tests/test_materia_form.py
+++ b/sapl/materia/tests/test_materia_form.py
@@ -1,7 +1,6 @@
import pytest
from django.utils.translation import ugettext as _
from model_mommy import mommy
-
from sapl.materia import forms
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py
index 611bdf080..67ecf010f 100644
--- a/sapl/materia/urls.py
+++ b/sapl/materia/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.materia.views import (AcompanhamentoConfirmarView,
AcompanhamentoExcluirView,
AcompanhamentoMateriaView, AnexadaCrud,
@@ -24,8 +23,7 @@ from sapl.materia.views import (AcompanhamentoConfirmarView,
TipoProposicaoCrud, TramitacaoCrud,
TramitacaoEmLoteView, UnidadeTramitacaoCrud,
proposicao_texto, recuperar_materia)
-
-from sapl.norma.views import NormaPesquisaSimplesView
+from sapl.norma.views import NormaPesquisaSimplesView
from .apps import AppConfig
diff --git a/sapl/materia/views.py b/sapl/materia/views.py
index 289976beb..6e08f00f0 100644
--- a/sapl/materia/views.py
+++ b/sapl/materia/views.py
@@ -2,6 +2,8 @@ from datetime import datetime
from random import choice
from string import ascii_letters, digits
+import sapl
+import weasyprint
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML
from django.contrib import messages
@@ -21,8 +23,6 @@ from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView
from django_filters.views import FilterView
-import weasyprint
-
from sapl.base.models import Autor, CasaLegislativa
from sapl.comissoes.models import Comissao, Participacao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT,
@@ -35,28 +35,28 @@ from sapl.crud.base import (ACTION_CREATE, ACTION_DELETE, ACTION_DETAIL,
PermissionRequiredForAppCrudMixin, make_pagination)
from sapl.materia.forms import (AnexadaForm, AutoriaForm,
AutoriaMultiCreateForm,
- ConfirmarProposicaoForm, LegislacaoCitadaForm,
- ProposicaoForm, TipoProposicaoForm,
- TramitacaoForm, TramitacaoUpdateForm,
- DevolverProposicaoForm, OrgaoForm)
+ ConfirmarProposicaoForm,
+ DevolverProposicaoForm, LegislacaoCitadaForm,
+ OrgaoForm, 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, show_results_filter_set, get_mime_type_from_file_extension)
-import sapl
+ get_mime_type_from_file_extension, montar_row_autor,
+ show_results_filter_set)
from .email_utils import do_envia_email_confirmacao
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
AdicionarVariasAutoriasFilterSet, DespachoInicialForm,
DocumentoAcessorioForm, EtiquetaPesquisaForm,
FichaPesquisaForm, FichaSelecionaForm, MateriaAssuntoForm,
- MateriaLegislativaFilterSet, MateriaSimplificadaForm,
- PrimeiraTramitacaoEmLoteFilterSet, ReceberProposicaoForm,
- RelatoriaForm, TramitacaoEmLoteFilterSet,
- filtra_tramitacao_destino,
+ MateriaLegislativaFilterSet, MateriaLegislativaForm,
+ MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet,
+ ReceberProposicaoForm, RelatoriaForm,
+ TramitacaoEmLoteFilterSet, filtra_tramitacao_destino,
filtra_tramitacao_destino_and_status,
- filtra_tramitacao_status, MateriaLegislativaForm)
+ filtra_tramitacao_status)
from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria,
DespachoInicial, DocumentoAcessorio, MateriaAssunto,
MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao,
@@ -65,7 +65,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, '')
@@ -296,14 +295,17 @@ def recuperar_materia(request):
return response
+
StatusTramitacaoCrud = CrudAux.build(StatusTramitacao, 'status_tramitacao')
+
class OrgaoCrud(Crud):
model = Orgao
class CreateView(Crud.CreateView):
form_class = OrgaoForm
+
class TipoProposicaoCrud(CrudAux):
model = TipoProposicao
help_text = 'tipo_proposicao'
diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py
index 5207011a6..c9daaec9f 100644
--- a/sapl/norma/forms.py
+++ b/sapl/norma/forms.py
@@ -8,7 +8,6 @@ from django.db import models
from django.forms import ModelForm, widgets
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
-
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.settings import MAX_DOC_UPLOAD_SIZE
@@ -215,7 +214,8 @@ class NormaRelacionadaForm(ModelForm):
relacionada.norma_relacionada = self.cleaned_data['norma_relacionada']
relacionada.save()
return relacionada
-
+
+
class NormaPesquisaSimplesForm(forms.Form):
tipo_norma = forms.ModelChoiceField(
label=TipoNormaJuridica._meta.verbose_name,
@@ -234,7 +234,7 @@ class NormaPesquisaSimplesForm(forms.Form):
required=False,
widget=forms.DateInput(format='%d/%m/%Y')
)
-
+
titulo = forms.CharField(
label='Título do Relatório',
required=False,
@@ -247,7 +247,7 @@ class NormaPesquisaSimplesForm(forms.Form):
[('tipo_norma', 6),
('data_inicial', 3),
('data_final', 3)])
-
+
row2 = to_row(
[('titulo', 12)])
@@ -259,25 +259,23 @@ class NormaPesquisaSimplesForm(forms.Form):
form_actions(label='Pesquisar')
)
)
-
+
def clean(self):
super(NormaPesquisaSimplesForm, self).clean()
cleaned_data = self.cleaned_data
data_inicial = cleaned_data['data_inicial']
data_final = cleaned_data['data_final']
-
- if (data_inicial and data_final and
- data_inicial > data_final):
- raise ValidationError(_(
- 'A Data Final não pode ser menor que a Data Inicial'))
- else:
- condicao1 = data_inicial and not data_final
- condicao2 = not data_inicial and data_final
- if condicao1 or condicao2:
- raise ValidationError(_('Caso pesquise por data, os campos de Data Inicial e ' +
- 'Data Final devem ser preenchidos obrigatoriamente'))
+ if (data_inicial and data_final and
+ data_inicial > data_final):
+ raise ValidationError(_(
+ 'A Data Final não pode ser menor que a Data Inicial'))
+ else:
+ condicao1 = data_inicial and not data_final
+ condicao2 = not data_inicial and data_final
+ if condicao1 or condicao2:
+ raise ValidationError(_('Caso pesquise por data, os campos de Data Inicial e ' +
+ 'Data Final devem ser preenchidos obrigatoriamente'))
return cleaned_data
-
diff --git a/sapl/norma/models.py b/sapl/norma/models.py
index 0836ed506..589d61adf 100644
--- a/sapl/norma/models.py
+++ b/sapl/norma/models.py
@@ -4,7 +4,6 @@ from django.db import models
from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
-
from sapl.compilacao.models import TextoArticulado
from sapl.materia.models import MateriaLegislativa
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
diff --git a/sapl/norma/tests/test_norma.py b/sapl/norma/tests/test_norma.py
index fe068b777..8d40b7202 100644
--- a/sapl/norma/tests/test_norma.py
+++ b/sapl/norma/tests/test_norma.py
@@ -2,9 +2,9 @@ import pytest
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy
-
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
-from sapl.norma.forms import NormaJuridicaForm, NormaRelacionadaForm, NormaPesquisaSimplesForm
+from sapl.norma.forms import (NormaJuridicaForm, NormaPesquisaSimplesForm,
+ NormaRelacionadaForm)
from sapl.norma.models import NormaJuridica, TipoNormaJuridica
@@ -137,9 +137,9 @@ def test_norma_pesquisa_form_datas_invalidas():
tipo = mommy.make(TipoNormaJuridica)
form = NormaPesquisaSimplesForm(data={'tipo_norma': str(tipo.pk),
- 'data_inicial': '10/11/2017',
- 'data_final': '09/11/2017'
- })
+ 'data_inicial': '10/11/2017',
+ 'data_final': '09/11/2017'
+ })
assert not form.is_valid()
assert form.errors['__all__'] == [_('A Data Final não pode ser menor que '
'a Data Inicial')]
diff --git a/sapl/norma/urls.py b/sapl/norma/urls.py
index 93081c4fc..12ba05cba 100644
--- a/sapl/norma/urls.py
+++ b/sapl/norma/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView,
NormaRelacionadaCrud, NormaTaView, TipoNormaCrud,
TipoVinculoNormaJuridicaCrud, recuperar_norma,
diff --git a/sapl/norma/views.py b/sapl/norma/views.py
index 6490b816e..249d480b0 100644
--- a/sapl/norma/views.py
+++ b/sapl/norma/views.py
@@ -1,26 +1,24 @@
+import weasyprint
+from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
-from django.http import JsonResponse
+from django.http import HttpResponse, JsonResponse
+from django.template import RequestContext, loader
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
+from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView
-from django_filters.views import FilterView
-from django.contrib.auth.mixins import PermissionRequiredMixin
-
-from django.http import HttpResponse, JsonResponse
from django.views.generic.edit import FormView
-from django.views.generic import CreateView, ListView, TemplateView, UpdateView
-from django.template import RequestContext, loader
-import weasyprint
-
+from django_filters.views import FilterView
from sapl.base.models import AppConfig
from sapl.compilacao.views import IntegracaoTaView
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud, make_pagination)
from sapl.utils import show_results_filter_set
-from .forms import NormaFilterSet, NormaJuridicaForm, NormaRelacionadaForm, NormaPesquisaSimplesForm
+from .forms import (NormaFilterSet, NormaJuridicaForm,
+ NormaPesquisaSimplesForm, NormaRelacionadaForm)
from .models import (AssuntoNorma, NormaJuridica, NormaRelacionada,
TipoNormaJuridica, TipoVinculoNormaJuridica)
@@ -243,21 +241,19 @@ def gerar_pdf_impressos(request, context, template_name):
return response
+
class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView):
form_class = NormaPesquisaSimplesForm
template_name = 'materia/impressos/norma.html'
permission_required = ('materia.can_access_impressos', )
-
-
-
+
def form_valid(self, form):
normas = NormaJuridica.objects.all().order_by(
'numero')
template_norma = 'materia/impressos/normas_pdf.html'
-
+
titulo = form.cleaned_data['titulo']
-
if form.cleaned_data['tipo_norma']:
normas = normas.filter(tipo=form.cleaned_data['tipo_norma'])
@@ -265,13 +261,13 @@ class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView):
normas = normas.filter(
data__gte=form.cleaned_data['data_inicial'],
data__lte=form.cleaned_data['data_final'])
-
+
qtd_resultados = len(normas)
if qtd_resultados > 2000:
normas = normas[:2000]
-
+
context = {'quantidade': qtd_resultados,
'titulo': titulo,
'normas': normas}
-
+
return gerar_pdf_impressos(self.request, context, template_norma)
diff --git a/sapl/painel/views.py b/sapl/painel/views.py
index 2ab353b50..5acb06195 100644
--- a/sapl/painel/views.py
+++ b/sapl/painel/views.py
@@ -11,16 +11,15 @@ from django.http.response import Http404, HttpResponseRedirect
from django.shortcuts import render
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import AppConfig as ConfiguracoesAplicacao
from sapl.base.models import CasaLegislativa
from sapl.crud.base import Crud
from sapl.painel.apps import AppConfig
from sapl.parlamentares.models import Legislatura, Parlamentar, Votante
-from sapl.sessao.models import (ExpedienteMateria, OrdemDia, OradorExpediente,
- PresencaOrdemDia,
- RegistroVotacao, SessaoPlenaria,
- SessaoPlenariaPresenca, VotoParlamentar)
+from sapl.sessao.models import (ExpedienteMateria, OradorExpediente, OrdemDia,
+ PresencaOrdemDia, RegistroVotacao,
+ SessaoPlenaria, SessaoPlenariaPresenca,
+ VotoParlamentar)
from sapl.utils import filiacao_data, get_client_ip, sort_lista_chave
from .models import Cronometro
@@ -304,16 +303,16 @@ def get_presentes(pk, response, materia):
oradores_list.append(
{
- 'nome': o.parlamentar.nome_parlamentar,
- 'numero': o.numero_ordem
+ 'nome': o.parlamentar.nome_parlamentar,
+ 'numero': o.numero_ordem
})
presentes_list = []
for p in presentes:
now_year = timezone.now().year
# Recupera a legislatura vigente
- legislatura = Legislatura.objects.get(data_inicio__year__lte = now_year,
- data_fim__year__gte = now_year)
+ legislatura = Legislatura.objects.get(data_inicio__year__lte=now_year,
+ data_fim__year__gte=now_year)
# Recupera os mandatos daquele parlamentar
mandatos = p.parlamentar.mandato_set.filter(legislatura=legislatura)
@@ -403,7 +402,6 @@ def get_votos(response, materia):
expediente_id=materia.id).order_by(
'parlamentar__nome_parlamentar')
-
for i, p in enumerate(response['presentes']):
try:
if votos_parlamentares.get(parlamentar_id=p['parlamentar_id']).voto:
diff --git a/sapl/parlamentares/forms.py b/sapl/parlamentares/forms.py
index 32a1b67de..80c78cf82 100644
--- a/sapl/parlamentares/forms.py
+++ b/sapl/parlamentares/forms.py
@@ -13,12 +13,11 @@ from django.forms import ModelForm
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from floppyforms.widgets import ClearableFileInput
-from image_cropping.widgets import ImageCropWidget, CropWidget
-
+from image_cropping.widgets import CropWidget, ImageCropWidget
+from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.rules import SAPL_GROUP_VOTANTE
-from sapl.base.models import Autor, TipoAutor
from .models import (ComposicaoColigacao, Filiacao, Frente, Legislatura,
Mandato, Parlamentar, Votante)
@@ -177,10 +176,10 @@ class ParlamentarCreateForm(ParlamentarForm):
object_id = parlamentar.pk
tipo = TipoAutor.objects.get(descricao='Parlamentar')
Autor.objects.create(
- content_type = content_type,
- object_id = object_id,
- tipo = tipo,
- nome = parlamentar.nome_parlamentar
+ content_type=content_type,
+ object_id=object_id,
+ tipo=tipo,
+ nome=parlamentar.nome_parlamentar
)
return parlamentar
diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py
index 239e75cab..47cc44954 100644
--- a/sapl/parlamentares/models.py
+++ b/sapl/parlamentares/models.py
@@ -1,11 +1,10 @@
+import reversion
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from image_cropping.fields import ImageCropField, ImageRatioField
from model_utils import Choices
-import reversion
-
from sapl.base.models import Autor
from sapl.decorators import vigencia_atual
from sapl.utils import (INDICADOR_AFASTAMENTO, LISTA_DE_UFS, YES_NO_CHOICES,
diff --git a/sapl/parlamentares/tests/test_mandato.py b/sapl/parlamentares/tests/test_mandato.py
index cc027da1f..df0aabc7f 100644
--- a/sapl/parlamentares/tests/test_mandato.py
+++ b/sapl/parlamentares/tests/test_mandato.py
@@ -2,7 +2,6 @@ from datetime import datetime
import pytest
from model_mommy import mommy
-
from sapl.parlamentares.models import Filiacao, Legislatura, Mandato
pytestmark = pytest.mark.django_db
diff --git a/sapl/parlamentares/tests/test_parlamentares.py b/sapl/parlamentares/tests/test_parlamentares.py
index ba1f560b9..b34d2d6fd 100644
--- a/sapl/parlamentares/tests/test_parlamentares.py
+++ b/sapl/parlamentares/tests/test_parlamentares.py
@@ -2,7 +2,6 @@ import pytest
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy
-
from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm
from sapl.parlamentares.models import (Dependente, Filiacao, Legislatura,
Mandato, Parlamentar, Partido,
diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py
index e383421c4..4f7cd4c91 100644
--- a/sapl/parlamentares/urls.py
+++ b/sapl/parlamentares/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud,
ComposicaoColigacaoCrud, DependenteCrud,
FiliacaoCrud, FrenteCrud, FrenteList,
diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py
index a96873f18..dda454de7 100644
--- a/sapl/parlamentares/views.py
+++ b/sapl/parlamentares/views.py
@@ -1,5 +1,5 @@
-from datetime import datetime
import json
+from datetime import datetime
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
@@ -16,7 +16,6 @@ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import FormView
from django.views.generic.edit import UpdateView
-
from sapl.base.models import Autor
from sapl.comissoes.models import Participacao
from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux,
@@ -26,14 +25,13 @@ 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, FrenteForm)
+from .forms import (FiliacaoForm, FrenteForm, LegislaturaForm, MandatoForm,
+ ParlamentarCreateForm, ParlamentarForm, VotanteForm)
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
Dependente, Filiacao, Frente, Legislatura, Mandato,
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 6a0dc1b9a..15f4850b0 100644
--- a/sapl/protocoloadm/forms.py
+++ b/sapl/protocoloadm/forms.py
@@ -10,7 +10,6 @@ from django.db import models
from django.forms import ModelForm
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa,
diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py
index d4d45b3ad..43e18ffd5 100644
--- a/sapl/protocoloadm/models.py
+++ b/sapl/protocoloadm/models.py
@@ -2,7 +2,6 @@ import reversion
from django.db import models
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.utils import RANGE_ANOS, YES_NO_CHOICES, texto_upload_path
diff --git a/sapl/protocoloadm/tests/test_protocoloadm.py b/sapl/protocoloadm/tests/test_protocoloadm.py
index 12f49b39a..31e957513 100644
--- a/sapl/protocoloadm/tests/test_protocoloadm.py
+++ b/sapl/protocoloadm/tests/test_protocoloadm.py
@@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy
-
from sapl.materia.models import UnidadeTramitacao
from sapl.protocoloadm.forms import (AnularProcoloAdmForm,
DocumentoAdministrativoForm,
diff --git a/sapl/protocoloadm/urls.py b/sapl/protocoloadm/urls.py
index 46fec9980..77512ff01 100644
--- a/sapl/protocoloadm/urls.py
+++ b/sapl/protocoloadm/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.protocoloadm.views import (AnularProtocoloAdmView,
ComprovanteProtocoloView,
CriarDocumentoProtocolo,
diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py
index eb2a18852..084d90e63 100644
--- a/sapl/protocoloadm/views.py
+++ b/sapl/protocoloadm/views.py
@@ -1,4 +1,5 @@
+import sapl
from braces.views import FormValidMessageMixin
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
@@ -14,15 +15,16 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, ListView
from django.views.generic.base import RedirectView, TemplateView
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 Legislatura, Parlamentar
from sapl.protocoloadm.models import Protocolo
-from sapl.utils import create_barcode, get_client_ip, show_results_filter_set, get_mime_type_from_file_extension
+from sapl.utils import (create_barcode, get_client_ip,
+ get_mime_type_from_file_extension,
+ show_results_filter_set)
+
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
DocumentoAdministrativoFilterSet,
DocumentoAdministrativoForm, ProtocoloDocumentForm,
diff --git a/sapl/redireciona_urls/views.py b/sapl/redireciona_urls/views.py
index 7a293d994..41d58db33 100644
--- a/sapl/redireciona_urls/views.py
+++ b/sapl/redireciona_urls/views.py
@@ -1,6 +1,5 @@
from django.core.urlresolvers import NoReverseMatch, reverse
from django.views.generic import RedirectView
-
from sapl.base.apps import AppConfig as atasConfig
from sapl.comissoes.apps import AppConfig as comissoesConfig
from sapl.materia.apps import AppConfig as materiaConfig
diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py
index f4807c846..30da38f8d 100644
--- a/sapl/relatorios/views.py
+++ b/sapl/relatorios/views.py
@@ -6,7 +6,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404, HttpResponse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import Autor, CasaLegislativa
from sapl.comissoes.models import Comissao
from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao,
diff --git a/sapl/rules/apps.py b/sapl/rules/apps.py
index 606190110..2b03bf239 100644
--- a/sapl/rules/apps.py
+++ b/sapl/rules/apps.py
@@ -10,7 +10,6 @@ from django.db import models, router
from django.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
-
from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES,
SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA,
SAPL_GROUP_PAINEL, SAPL_GROUP_PROTOCOLO,
diff --git a/sapl/rules/tests/test_rules.py b/sapl/rules/tests/test_rules.py
index 099ca8bf7..8657290b8 100644
--- a/sapl/rules/tests/test_rules.py
+++ b/sapl/rules/tests/test_rules.py
@@ -5,7 +5,6 @@ from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.utils import six
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import (Argumento, CasaLegislativa, Constraint,
ProblemaMigracao)
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado,
@@ -53,6 +52,7 @@ def test_models_in_rules_patterns(model_item):
str(model_item),
model_item._meta.verbose_name)
+
# __falsos_positivos__
__fp__in__test_permission_of_models_in_rules_patterns = {
map_rules.RP_ADD: [CasaLegislativa,
diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py
index b6496f557..59fd3391c 100644
--- a/sapl/sessao/forms.py
+++ b/sapl/sessao/forms.py
@@ -9,7 +9,6 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import transaction
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
-
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.forms import MateriaLegislativaFilterSet
@@ -20,8 +19,9 @@ from sapl.utils import (RANGE_DIAS_MES, RANGE_MESES,
MateriaPesquisaOrderingFilter, autor_label,
autor_modal, timezone)
-from .models import (Bancada, ExpedienteMateria, Orador, OradorExpediente,
- OrdemDia, SessaoPlenaria, SessaoPlenariaPresenca, TipoResultadoVotacao, Bloco)
+from .models import (Bancada, Bloco, ExpedienteMateria, Orador,
+ OradorExpediente, OrdemDia, SessaoPlenaria,
+ SessaoPlenariaPresenca, TipoResultadoVotacao)
def recupera_anos():
@@ -129,6 +129,7 @@ class BancadaForm(ModelForm):
)
return bancada
+
class BlocoForm(ModelForm):
class Meta:
@@ -160,6 +161,7 @@ class BlocoForm(ModelForm):
)
return bloco
+
class ExpedienteMateriaForm(ModelForm):
_model = ExpedienteMateria
diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py
index 69e2cf57f..db7c50d9b 100644
--- a/sapl/sessao/models.py
+++ b/sapl/sessao/models.py
@@ -2,7 +2,6 @@ import reversion
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
-
from sapl.base.models import Autor
from sapl.materia.models import MateriaLegislativa
from sapl.parlamentares.models import (CargoMesa, Legislatura, Parlamentar,
diff --git a/sapl/sessao/tests/test_sessao.py b/sapl/sessao/tests/test_sessao.py
index 38f89acfe..37a17d1ed 100644
--- a/sapl/sessao/tests/test_sessao.py
+++ b/sapl/sessao/tests/test_sessao.py
@@ -1,7 +1,6 @@
import pytest
from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy
-
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.parlamentares.models import Legislatura, Partido, SessaoLegislativa
from sapl.sessao import forms
diff --git a/sapl/sessao/tests/test_sessao_view.py b/sapl/sessao/tests/test_sessao_view.py
index 082652c19..29e27c169 100644
--- a/sapl/sessao/tests/test_sessao_view.py
+++ b/sapl/sessao/tests/test_sessao_view.py
@@ -2,7 +2,6 @@ import pytest
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy
-
from sapl.parlamentares.models import Legislatura, SessaoLegislativa
from sapl.sessao.models import SessaoPlenaria, TipoSessaoPlenaria
diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py
index d9a611ba8..729c43d58 100644
--- a/sapl/sessao/urls.py
+++ b/sapl/sessao/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from sapl.sessao.views import (AdicionarVariasMateriasExpediente,
AdicionarVariasMateriasOrdemDia, BancadaCrud,
BlocoCrud, CargoBancadaCrud,
@@ -18,9 +17,8 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente,
VotacaoNominalExpedienteDetailView,
VotacaoNominalExpedienteEditView,
VotacaoNominalExpedienteView,
- VotacaoNominalView,
VotacaoNominalTransparenciaDetailView,
- VotacaoView, abrir_votacao,
+ VotacaoNominalView, VotacaoView, abrir_votacao,
atualizar_mesa, insere_parlamentar_composicao,
mudar_ordem_materia_sessao, recuperar_materia,
recuperar_numero_sessao,
diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py
index 357a500fd..b126f4ca7 100644
--- a/sapl/sessao/views.py
+++ b/sapl/sessao/views.py
@@ -20,7 +20,6 @@ from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView
from django.views.generic.edit import FormMixin
from django_filters.views import FilterView
-
from sapl.base.models import AppConfig as AppsAppConfig
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud,
@@ -36,12 +35,12 @@ from sapl.sessao.apps import AppConfig
from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm
from sapl.utils import show_results_filter_set
-from .forms import (AdicionarVariasMateriasFilterSet, ExpedienteForm,
- ListMateriaForm, MesaForm, OradorExpedienteForm,
- OradorForm, PautaSessaoFilterSet, PresencaForm,
- ResumoOrdenacaoForm, SessaoPlenariaFilterSet,
+from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm, BlocoForm,
+ ExpedienteForm, ListMateriaForm, MesaForm,
+ OradorExpedienteForm, OradorForm, PautaSessaoFilterSet,
+ PresencaForm, ResumoOrdenacaoForm, SessaoPlenariaFilterSet,
SessaoPlenariaForm, VotacaoEditForm, VotacaoForm,
- VotacaoNominalForm, BancadaForm, BlocoForm)
+ VotacaoNominalForm)
from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
ExpedienteMateria, ExpedienteSessao, IntegranteMesa,
MateriaLegislativa, Orador, OradorExpediente, OrdemDia,
@@ -171,12 +170,12 @@ def customize_link_materia(context, pk):
turno__isnull=False,
data_tramitacao__lte=data_inicio_sessao
).exclude(turno__exact=''
- ).select_related(
- 'materia',
- 'status',
- 'materia__tipo').order_by(
- '-data_tramitacao'
- ).first()
+ ).select_related(
+ 'materia',
+ 'status',
+ 'materia__tipo').order_by(
+ '-data_tramitacao'
+ ).first()
turno = ' '
if tramitacao is not None:
for t in Tramitacao.TURNO_CHOICES:
@@ -355,7 +354,7 @@ class MateriaOrdemDiaCrud(MasterDetailCrud):
'pk': obj.sessao_plenaria_id,
'oid': obj.pk,
'mid': obj.materia_id}) +\
- '?&materia=ordem'
+ '?&materia=ordem'
obj.resultado = ('%s
%s' %
(url,
resultado_descricao,
@@ -489,7 +488,7 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
'pk': obj.sessao_plenaria_id,
'oid': obj.pk,
'mid': obj.materia_id}) +\
- '?&materia=expediente'
+ '?&materia=expediente'
obj.resultado = ('%s
%s' %
(url,
resultado_descricao,
@@ -572,6 +571,7 @@ class OradorCrud(OradorCrud):
return reverse('sapl.sessao:orador_list',
kwargs={'pk': self.kwargs['pk']})
+
class BancadaCrud(Crud):
model = Bancada
@@ -581,6 +581,7 @@ class BancadaCrud(Crud):
def get_success_url(self):
return reverse('sapl.sessao:bancada_list')
+
class BlocoCrud(Crud):
model = Bloco
@@ -590,6 +591,7 @@ class BlocoCrud(Crud):
def get_success_url(self):
return reverse('sapl.sessao:bloco_list')
+
def recuperar_numero_sessao(request):
try:
sessao = SessaoPlenaria.objects.filter(
@@ -1793,7 +1795,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
except ObjectDoesNotExist:
raise Http404()
-
if 'cancelar-votacao' in request.POST:
fechar_votacao_materia(materia_votacao)
return self.form_valid(form)
@@ -1820,7 +1821,7 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
# Caso todas as opções sejam 'Não votou', fecha a votação
if nao_votou == len(request.POST.getlist('voto_parlamentar')):
- form.add_error(None, 'Não é possível finalizar a votação sem '\
+ form.add_error(None, 'Não é possível finalizar a votação sem '
'nenhum voto')
return self.form_invalid(form)
@@ -1916,7 +1917,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
'oid': self.kwargs['oid'],
'mid': self.kwargs['mid']}))
-
def get_parlamentares(self, presencas):
self.object = self.get_object()
@@ -2121,7 +2121,6 @@ class VotacaoNominalTransparenciaDetailView(TemplateView):
yield tipo
-
class VotacaoNominalExpedienteDetailView(DetailView):
template_name = 'sessao/votacao/nominal_detail.html'
@@ -2523,7 +2522,6 @@ class PautaSessaoDetailView(DetailView):
return self.render_to_response(context)
-
class PesquisarSessaoPlenariaView(FilterView):
model = SessaoPlenaria
filterset_class = SessaoPlenariaFilterSet
diff --git a/sapl/settings.py b/sapl/settings.py
index fcf6707f7..e7c20eb4d 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)
diff --git a/sapl/test_crispy_layout_mixin.py b/sapl/test_crispy_layout_mixin.py
index 2c72a1b44..bb063a445 100644
--- a/sapl/test_crispy_layout_mixin.py
+++ b/sapl/test_crispy_layout_mixin.py
@@ -1,7 +1,6 @@
from unittest import mock
import rtyaml
-
from sapl.crispy_layout_mixin import read_layout_from_yaml
diff --git a/sapl/test_urls.py b/sapl/test_urls.py
index bffb59c18..9df5900ee 100644
--- a/sapl/test_urls.py
+++ b/sapl/test_urls.py
@@ -1,20 +1,18 @@
+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 ugettext_lazy as _
-import pytest
-
+from django.utils.translation import string_concat
from sapl.crud.base import PermissionRequiredForAppCrudMixin
from sapl.rules.apps import AppConfig, update_groups
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/urls.py b/sapl/urls.py
index 38667b4e7..d5d6cc652 100644
--- a/sapl/urls.py
+++ b/sapl/urls.py
@@ -13,13 +13,6 @@ Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
-from django.conf import settings
-from django.conf.urls import include, url
-from django.conf.urls.static import static
-from django.contrib import admin
-from django.views.generic.base import RedirectView, TemplateView
-from django.views.static import serve as view_static_server
-
import sapl.api.urls
import sapl.base.urls
import sapl.comissoes.urls
@@ -33,6 +26,12 @@ import sapl.protocoloadm.urls
import sapl.redireciona_urls.urls
import sapl.relatorios.urls
import sapl.sessao.urls
+from django.conf import settings
+from django.conf.urls import include, url
+from django.conf.urls.static import static
+from django.contrib import admin
+from django.views.generic.base import RedirectView, TemplateView
+from django.views.static import serve as view_static_server
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'),
diff --git a/sapl/utils.py b/sapl/utils.py
index b86f6830c..01f0f5f2b 100644
--- a/sapl/utils.py
+++ b/sapl/utils.py
@@ -23,7 +23,6 @@ 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
@@ -272,6 +271,7 @@ def listify(function):
return list(function(*args, **kwargs))
return f
+
LISTA_DE_UFS = [
('AC', 'Acre'),
('AL', 'Alagoas'),
@@ -710,4 +710,4 @@ def TrocaTag(texto, startTag, endTag, sizeStart, sizeEnd, styleName):
textoSaida += texto[i]
i = i + 1
- return textoSaida
\ No newline at end of file
+ return textoSaida
diff --git a/scripts/anonimizador/anon.py b/scripts/anonimizador/anon.py
index 98618cee7..13aef6ad7 100644
--- a/scripts/anonimizador/anon.py
+++ b/scripts/anonimizador/anon.py
@@ -5,7 +5,6 @@ from string import digits
from django.apps import apps
from django.db.models.fields import CharField, TextField
-
from sapl.materia.models import Orgao, Origem
from sapl.norma.models import AssuntoNorma
from sapl.parlamentares.models import Municipio, NivelInstrucao, Partido
diff --git a/scripts/atualizar_requirements.py b/scripts/atualizar_requirements.py
index 5b8e22d22..897ac5a42 100755
--- a/scripts/atualizar_requirements.py
+++ b/scripts/atualizar_requirements.py
@@ -33,6 +33,7 @@ def novas_linhas(linhas):
nome = nome.lower()
yield '%s==%s' % (nome, freeze[nome])
+
for arq, linhas in requirements:
with open(arq, 'w') as f:
f.writelines(l + '\n' for l in novas_linhas(linhas))
diff --git a/scripts/convert_null_to_empty_in_all_char_fields.py b/scripts/convert_null_to_empty_in_all_char_fields.py
index 8ad5243a7..2a8699217 100644
--- a/scripts/convert_null_to_empty_in_all_char_fields.py
+++ b/scripts/convert_null_to_empty_in_all_char_fields.py
@@ -1,6 +1,5 @@
from django.apps import apps
from django.db import models
-
from sapl.settings import SAPL_APPS
diff --git a/scripts/fk_protocoloadm_docadm.py b/scripts/fk_protocoloadm_docadm.py
index a4294206c..cb66a74bd 100644
--- a/scripts/fk_protocoloadm_docadm.py
+++ b/scripts/fk_protocoloadm_docadm.py
@@ -3,7 +3,6 @@
from django.core.exceptions import ObjectDoesNotExist
-
from sapl.protocoloadm.models import DocumentoAdministrativo, Protocolo
diff --git a/scripts/redbaron.py b/scripts/redbaron.py
index 7da26d2c5..c3d0894df 100644
--- a/scripts/redbaron.py
+++ b/scripts/redbaron.py
@@ -64,6 +64,8 @@ def frase(n):
def mark(n):
mark.ok |= {n.value}
+
+
mark.ok = set()
diff --git a/scripts/set_inicio_mandato.py b/scripts/set_inicio_mandato.py
index dca509ab6..1d215131e 100644
--- a/scripts/set_inicio_mandato.py
+++ b/scripts/set_inicio_mandato.py
@@ -6,5 +6,6 @@ def popula_campo_data_inicio():
m.data_inicio_mandato = m.legislatura.data_inicio
m.save()
+
if __name__ == '__main__':
popula_campo_data_inicio()