Browse Source

Conserta PEP 8

pull/1765/head
Marcio Mazza 7 years ago
parent
commit
3b7f768c29
  1. 1
      sapl/api/forms.py
  2. 1
      sapl/api/serializers.py
  3. 1
      sapl/api/urls.py
  4. 1
      sapl/api/views.py
  5. 1
      sapl/base/admin.py
  6. 30
      sapl/base/forms.py
  7. 3
      sapl/base/search_indexes.py
  8. 3
      sapl/base/templatetags/common_tags.py
  9. 4
      sapl/base/templatetags/menus.py
  10. 1
      sapl/base/tests/test_form.py
  11. 1
      sapl/base/tests/teststub_urls.py
  12. 9
      sapl/base/urls.py
  13. 16
      sapl/base/views.py
  14. 1
      sapl/comissoes/forms.py
  15. 2
      sapl/comissoes/models.py
  16. 1
      sapl/comissoes/tests/test_comissoes.py
  17. 4
      sapl/comissoes/urls.py
  18. 19
      sapl/comissoes/views.py
  19. 6
      sapl/compilacao/apps.py
  20. 1
      sapl/compilacao/forms.py
  21. 2
      sapl/compilacao/models.py
  22. 1
      sapl/compilacao/templatetags/compilacao_filters.py
  23. 2
      sapl/compilacao/tests/test_tipo_texto_articulado_form.py
  24. 1
      sapl/compilacao/urls.py
  25. 9
      sapl/compilacao/views.py
  26. 2
      sapl/crispy_layout_mixin.py
  27. 3
      sapl/crud/base.py
  28. 1
      sapl/crud/tests/test_base.py
  29. 1
      sapl/legacy/management/commands/migracao_documentos.py
  30. 1
      sapl/legacy/scripts/exporta_zope/exporta_zope.py
  31. 2
      sapl/legacy/scripts/scrap_original_forms.py
  32. 1
      sapl/legacy/scripts/study.py
  33. 1
      sapl/lexml/urls.py
  34. 5
      sapl/materia/admin.py
  35. 1
      sapl/materia/email_utils.py
  36. 13
      sapl/materia/forms.py
  37. 2
      sapl/materia/models.py
  38. 1
      sapl/materia/receivers.py
  39. 1
      sapl/materia/tests/test_email_templates.py
  40. 14
      sapl/materia/tests/test_materia.py
  41. 1
      sapl/materia/tests/test_materia_form.py
  42. 3
      sapl/materia/urls.py
  43. 5
      sapl/materia/views.py
  44. 1
      sapl/norma/forms.py
  45. 1
      sapl/norma/tests/test_norma.py
  46. 1
      sapl/norma/urls.py
  47. 1
      sapl/norma/views.py
  48. 1
      sapl/painel/views.py
  49. 1
      sapl/parlamentares/forms.py
  50. 1
      sapl/parlamentares/models.py
  51. 1
      sapl/parlamentares/tests/test_mandato.py
  52. 1
      sapl/parlamentares/tests/test_parlamentares.py
  53. 1
      sapl/parlamentares/urls.py
  54. 3
      sapl/parlamentares/views.py
  55. 15
      sapl/protocoloadm/forms.py
  56. 1
      sapl/protocoloadm/models.py
  57. 1
      sapl/protocoloadm/tests/test_protocoloadm.py
  58. 1
      sapl/protocoloadm/urls.py
  59. 3
      sapl/protocoloadm/views.py
  60. 2
      sapl/redireciona_urls/views.py
  61. 7
      sapl/relatorios/views.py
  62. 1
      sapl/rules/apps.py
  63. 1
      sapl/rules/tests/test_rules.py
  64. 1
      sapl/sessao/forms.py
  65. 1
      sapl/sessao/tests/test_sessao_view.py
  66. 1
      sapl/sessao/urls.py
  67. 1
      sapl/sessao/views.py
  68. 1
      sapl/test_crispy_layout_mixin.py
  69. 5
      sapl/test_urls.py
  70. 13
      sapl/urls.py
  71. 11
      sapl/utils.py
  72. 1
      scripts/anonimizador/anon.py
  73. 1
      scripts/convert_null_to_empty_in_all_char_fields.py
  74. 1
      scripts/fk_protocoloadm_docadm.py

1
sapl/api/forms.py

@ -7,6 +7,7 @@ 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

1
sapl/api/serializers.py

@ -1,4 +1,5 @@
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

1
sapl/api/urls.py

@ -1,6 +1,7 @@
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)

1
sapl/api/views.py

@ -8,6 +8,7 @@ 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,

1
sapl/base/admin.py

@ -3,6 +3,7 @@ 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

30
sapl/base/forms.py

@ -13,16 +13,17 @@ from django.db import models, transaction
from django.forms import Form, ModelForm
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,
to_row)
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, ChoiceWithoutValidationField,
ImageThumbnailFileInput, RangeWidgetOverride,
autor_label, autor_modal, models_with_gr_for_model,
qs_override_django_filter, YES_NO_CHOICES)
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
ChoiceWithoutValidationField, ImageThumbnailFileInput,
RangeWidgetOverride, autor_label, autor_modal,
models_with_gr_for_model, qs_override_django_filter)
from .models import AppConfig, CasaLegislativa
@ -40,9 +41,11 @@ STATUS_USER_CHOICE = [
('X', _('Excluir Usuário')),
]
def get_roles():
return [(g.id, g.name) for g in Group.objects.all().order_by('name')]
class UsuarioCreateForm(ModelForm):
username = forms.CharField(required=True, label="Nome de usuário")
@ -50,16 +53,18 @@ class UsuarioCreateForm(ModelForm):
lastname = forms.CharField(required=True, label="Sobrenome")
password1 = forms.CharField(required=True, widget=forms.PasswordInput, label='Senha')
password2 = forms.CharField(required=True, widget=forms.PasswordInput, label='Confirmar senha')
user_active = forms.ChoiceField(required=False, choices=YES_NO_CHOICES, label="Usuário ativo?", initial='True')
user_active = forms.ChoiceField(required=False, choices=YES_NO_CHOICES,
label="Usuário ativo?", initial='True')
#ROLES = [(g.id, g.name) for g in Group.objects.all().order_by('name')]
roles = forms.MultipleChoiceField(required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles)
roles = forms.MultipleChoiceField(
required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles)
class Meta:
model = get_user_model()
fields = ['username', 'firstname', 'lastname', 'email', 'password1', 'password2', 'user_active', 'roles']
fields = ['username', 'firstname', 'lastname', 'email',
'password1', 'password2', 'user_active', 'roles']
def clean(self):
super(UsuarioCreateForm, self).clean()
@ -97,6 +102,7 @@ class UsuarioCreateForm(ModelForm):
'roles',
row4)
class UsuarioEditForm(ModelForm):
# ROLES = [(g.id, g.name) for g in Group.objects.all().order_by('name')]
@ -104,8 +110,10 @@ class UsuarioEditForm(ModelForm):
password1 = forms.CharField(required=False, widget=forms.PasswordInput, label='Senha')
password2 = forms.CharField(required=False, widget=forms.PasswordInput, label='Confirmar senha')
user_active = forms.ChoiceField(choices=YES_NO_CHOICES, required=True, label="Usuário ativo?", initial='True')
roles = forms.MultipleChoiceField(required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles)
user_active = forms.ChoiceField(choices=YES_NO_CHOICES, required=True,
label="Usuário ativo?", initial='True')
roles = forms.MultipleChoiceField(
required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles)
class Meta:
model = get_user_model()
@ -121,7 +129,6 @@ class UsuarioEditForm(ModelForm):
[('password1', 6),
('password2', 6)])
row3 = to_row([(form_actions(label='Salvar Alterações'), 6)])
self.helper = FormHelper()
@ -572,6 +579,7 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet):
form_actions(label='Pesquisar'))
)
class RelatorioDataFimPrazoTramitacaoFilterSet(django_filters.FilterSet):
filter_overrides = {models.DateField: {

3
sapl/base/search_indexes.py

@ -13,13 +13,14 @@ 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
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)

3
sapl/base/templatetags/common_tags.py

@ -1,11 +1,12 @@
from compressor.utils import get_class
from django import template
from django.template.defaultfilters import stringfilter
from sapl.base.models import AppConfig
from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa
from sapl.norma.models import NormaJuridica
from sapl.parlamentares.models import Filiacao
from sapl.utils import filiacao_data
from django.template.defaultfilters import stringfilter
register = template.Library()

4
sapl/base/templatetags/menus.py

@ -1,9 +1,9 @@
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
from sapl.utils import sapl_logger
register = template.Library()

1
sapl/base/tests/test_form.py

@ -1,5 +1,6 @@
import pytest
from django.utils.translation import ugettext_lazy as _
from sapl.base.forms import CasaLegislativaForm

1
sapl/base/tests/teststub_urls.py

@ -1,5 +1,6 @@
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
from sapl.urls import urlpatterns as original_patterns
ptrn = patterns('',

9
sapl/base/urls.py

@ -5,20 +5,21 @@ 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 (AlterarSenha, AppConfigCrud, CasaLegislativaCrud,
HelpTopicView, RelatorioAtasView,
CreateUsuarioView, DeleteUsuarioView, EditUsuarioView,
HelpTopicView, ListarUsuarioView, RelatorioAtasView,
RelatorioDataFimPrazoTramitacaoView,
RelatorioHistoricoTramitacaoView,
RelatorioMateriasPorAnoAutorTipoView,
RelatorioMateriasPorAutorView,
RelatorioMateriasTramitacaoView,
RelatorioPresencaSessaoView, SaplSearchView,
RelatorioDataFimPrazoTramitacaoView, ListarUsuarioView, EditUsuarioView, CreateUsuarioView,
DeleteUsuarioView)
RelatorioPresencaSessaoView, SaplSearchView)
app_name = AppConfig.name

16
sapl/base/views.py

@ -14,13 +14,15 @@ 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 _
from django.utils.translation import string_concat
from django.views.generic import FormView, ListView, DetailView, UpdateView, CreateView, DeleteView
from django.views.generic import (CreateView, DeleteView, DetailView, FormView,
ListView, UpdateView)
from django.views.generic.base import TemplateView
from django_filters.views import FilterView
from haystack.views import SearchView
from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm
from sapl.base.models import Autor, TipoAutor
from sapl.crud.base import (CrudAux, make_pagination)
from sapl.crud.base import CrudAux, make_pagination
from sapl.materia.models import (Autoria, MateriaLegislativa,
TipoMateriaLegislativa)
from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria,
@ -30,12 +32,13 @@ from sapl.utils import (parlamentares_ativos, sapl_logger,
from .forms import (AlterarSenhaForm, CasaLegislativaForm,
ConfiguracoesAppForm, RelatorioAtasFilterSet,
RelatorioDataFimPrazoTramitacaoFilterSet,
RelatorioHistoricoTramitacaoFilterSet,
RelatorioMateriasPorAnoAutorTipoFilterSet,
RelatorioMateriasPorAutorFilterSet,
RelatorioMateriasTramitacaoilterSet,
RelatorioPresencaSessaoFilterSet,
RelatorioDataFimPrazoTramitacaoFilterSet, UsuarioEditForm, UsuarioCreateForm)
RelatorioPresencaSessaoFilterSet, UsuarioCreateForm,
UsuarioEditForm)
from .models import AppConfig, CasaLegislativa
@ -70,6 +73,7 @@ class TipoAutorCrud(CrudAux):
return vn
class ListView(CrudAux.ListView):
def get_queryset(self):
qs = CrudAux.ListView.get_queryset(self)
qs = qs.filter(content_type__isnull=True)
@ -84,6 +88,7 @@ class TipoAutorCrud(CrudAux):
return context
class TipoAutorMixin:
def dispatch(self, request, *args, **kwargs):
object = self.get_object()
if object.content_type:
@ -359,6 +364,7 @@ class RelatorioHistoricoTramitacaoView(FilterView):
return context
class RelatorioDataFimPrazoTramitacaoView(FilterView):
model = MateriaLegislativa
filterset_class = RelatorioDataFimPrazoTramitacaoFilterSet
@ -569,6 +575,7 @@ class CreateUsuarioView(PermissionRequiredMixin, CreateView):
return HttpResponseRedirect(self.get_success_url())
class DeleteUsuarioView(PermissionRequiredMixin, DeleteView):
model = get_user_model()
@ -585,7 +592,6 @@ class DeleteUsuarioView(PermissionRequiredMixin, DeleteView):
return qs.filter(id=self.kwargs['pk'])
class EditUsuarioView(PermissionRequiredMixin, UpdateView):
model = get_user_model()
form_class = UsuarioEditForm

1
sapl/comissoes/forms.py

@ -5,6 +5,7 @@ from django.db import transaction
from django.db.models import Q
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao
from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar

2
sapl/comissoes/models.py

@ -1,7 +1,7 @@
import reversion
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
import reversion
from sapl.base.models import Autor
from sapl.parlamentares.models import Parlamentar

1
sapl/comissoes/tests/test_comissoes.py

@ -1,6 +1,7 @@
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

4
sapl/comissoes/urls.py

@ -1,7 +1,9 @@
from django.conf.urls import include, url
from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud,
MateriasTramitacaoListView, ParticipacaoCrud,
PeriodoComposicaoCrud, ReuniaoCrud, TipoComissaoCrud)
PeriodoComposicaoCrud, ReuniaoCrud,
TipoComissaoCrud)
from .apps import AppConfig

19
sapl/comissoes/views.py

@ -7,19 +7,17 @@ from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView
from django.views.generic.edit import FormMixin
from sapl.base.models import AppConfig as AppsAppConfig
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud,
CrudAux, MasterDetailCrud,
PermissionRequiredForAppCrudMixin)
from sapl.comissoes.apps import AppConfig
from sapl.comissoes.forms import ParticipacaoCreateForm, ParticipacaoEditForm
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud,
PermissionRequiredForAppCrudMixin)
from sapl.materia.models import MateriaLegislativa, Tramitacao
from .forms import ReuniaoForm, ComissaoForm
from .forms import ComissaoForm, ReuniaoForm
from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao, Reuniao)
from sapl.comissoes.apps import AppConfig
Periodo, Reuniao, TipoComissao)
def pegar_url_composicao(pk):
@ -60,6 +58,7 @@ class ParticipacaoCrud(MasterDetailCrud):
form_class = ParticipacaoEditForm
class DeleteView(MasterDetailCrud.DeleteView):
def get_success_url(self):
composicao_comissao_pk = self.object.composicao.comissao.pk
composicao_pk = self.object.composicao.pk
@ -147,6 +146,7 @@ class MateriasTramitacaoListView(ListView):
context['object'] = Comissao.objects.get(id=self.kwargs['pk'])
return context
class ReuniaoCrud(MasterDetailCrud):
model = Reuniao
parent_field = 'comissao'
@ -168,7 +168,6 @@ class ReuniaoCrud(MasterDetailCrud):
def get_initial(self):
return {'comissao': self.object.comissao}
class CreateView(MasterDetailCrud.CreateView):
form_class = ReuniaoForm
@ -177,11 +176,9 @@ class ReuniaoCrud(MasterDetailCrud):
return {'comissao': comissao}
class DeleteView(MasterDetailCrud.DeleteView):
pass
class DetailView(MasterDetailCrud.DetailView):
@xframe_options_exempt

6
sapl/compilacao/apps.py

@ -2,10 +2,10 @@ import logging
from django import apps
from django.conf import settings
from django.db import models, connection
from django.db import connection, models
from django.db.utils import DEFAULT_DB_ALIAS, IntegrityError
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 sapl.settings import BASE_DIR

1
sapl/compilacao/forms.py

@ -14,6 +14,7 @@ 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,

2
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,7 +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)

1
sapl/compilacao/templatetags/compilacao_filters.py

@ -4,6 +4,7 @@ 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()

2
sapl/compilacao/tests/test_tipo_texto_articulado_form.py

@ -1,6 +1,6 @@
import pytest
from django.utils.translation import ugettext as _
from model_mommy import mommy
import pytest
from sapl.compilacao import forms
from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota

1
sapl/compilacao/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.compilacao import views
from sapl.compilacao.views import (TipoDispositivoCrud, TipoNotaCrud,
TipoPublicacaoCrud, TipoVideCrud,

9
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,8 +19,8 @@ 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,
@ -48,10 +48,9 @@ from sapl.compilacao.models import (STATUS_TA_EDITION, STATUS_TA_PRIVATE,
from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED,
DISPOSITIVO_SELECT_RELATED_EDIT,
get_integrations_view_names)
from sapl.crud.base import Crud, CrudListView, make_pagination, CrudAux
from sapl.crud.base import Crud, CrudAux, CrudListView, make_pagination
from sapl.settings import BASE_DIR
TipoNotaCrud = CrudAux.build(TipoNota, 'tipo_nota')
TipoVideCrud = CrudAux.build(TipoVide, 'tipo_vide')
TipoPublicacaoCrud = CrudAux.build(TipoPublicacao, 'tipo_publicacao')

2
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):

3
sapl/crud/base.py

@ -17,8 +17,8 @@ from django.http.response import Http404
from django.shortcuts import redirect
from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.views.generic import (CreateView, DeleteView, DetailView, ListView,
UpdateView)
from django.views.generic.base import ContextMixin
@ -30,7 +30,6 @@ from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL,
from sapl.settings import BASE_DIR
from sapl.utils import normalize
logger = logging.getLogger(BASE_DIR.name)
ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \

1
sapl/crud/tests/test_base.py

@ -1,6 +1,7 @@
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

1
sapl/legacy/management/commands/migracao_documentos.py

@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand
from sapl.legacy.migracao_documentos import migrar_documentos

1
sapl/legacy/scripts/exporta_zope/exporta_zope.py

@ -14,6 +14,7 @@ from functools import partial
import magic
import yaml
import ZODB.DB
import ZODB.FileStorage
from ZODB.broken import Broken

2
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 sapl.crispy_layout_mixin import heads_and_tails
from sapl.legacy.migracao import appconfs, get_renames
from sapl.legacy.scripts.utils import getsourcelines

1
sapl/legacy/scripts/study.py

@ -1,4 +1,5 @@
from django.apps import apps
from sapl.legacy.migracao import legacy_app
for model in apps.get_app_config('legacy').get_models():

1
sapl/lexml/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud
from .apps import AppConfig

5
sapl/materia/admin.py

@ -4,11 +4,10 @@ from django.contrib import admin
from sapl.base.models import TipoAutor
from sapl.comissoes.models import TipoComissao
from sapl.materia.models import Proposicao
from sapl.parlamentares.models import TipoAfastamento, SituacaoMilitar, \
TipoDependente
from sapl.parlamentares.models import (SituacaoMilitar, TipoAfastamento,
TipoDependente)
from sapl.utils import register_all_models_in_admin
register_all_models_in_admin(__name__)
if not settings.DEBUG:

1
sapl/materia/email_utils.py

@ -4,6 +4,7 @@ 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

13
sapl/materia/forms.py

@ -1,7 +1,7 @@
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,
@ -22,7 +22,9 @@ 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 _
from sapl.base.models import Autor, TipoAutor, AppConfig
import sapl
from sapl.base.models import AppConfig, Autor, TipoAutor
from sapl.comissoes.models import Comissao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_PRIVATE)
@ -39,8 +41,8 @@ from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
ChoiceWithoutValidationField,
MateriaPesquisaOrderingFilter, RangeWidgetOverride,
autor_label, autor_modal, models_with_gr_for_model,
qs_override_django_filter, gerar_hash_arquivo)
autor_label, autor_modal, gerar_hash_arquivo,
models_with_gr_for_model, qs_override_django_filter)
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, Numeracao, Proposicao, Relatoria,
@ -1135,7 +1137,7 @@ class ProposicaoForm(forms.ModelForm):
widgets = {
'descricao': widgets.Textarea(attrs={'rows': 4}),
'tipo': TipoProposicaoSelect(),
'hash_code': forms.HiddenInput(),}
'hash_code': forms.HiddenInput(), }
def __init__(self, *args, **kwargs):
self.texto_articulado_proposicao = sapl.base.models.AppConfig.attr(
@ -1222,7 +1224,6 @@ class ProposicaoForm(forms.ModelForm):
# FIXME hash para textos articulados
inst.hash_code = 'P' + ta.hash() + '/' + str(inst.pk)
def clean(self):
super(ProposicaoForm, self).clean()

2
sapl/materia/models.py

@ -10,7 +10,7 @@ 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, SEQUENCIA_NUMERACAO
from sapl.base.models import SEQUENCIA_NUMERACAO, Autor
from sapl.comissoes.models import Comissao
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado,
TextoArticulado)

1
sapl/materia/receivers.py

@ -1,5 +1,6 @@
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

1
sapl/materia/tests/test_email_templates.py

@ -1,4 +1,5 @@
from django.core import mail
from sapl.materia.email_utils import enviar_emails, load_email_templates

14
sapl/materia/tests/test_materia.py

@ -1,12 +1,12 @@
import pytest
from django.db.models import Max
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 django.db.models import Max
from model_mommy import mommy
from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura
from sapl.comissoes.models import Comissao, TipoComissao
from sapl.materia.models import (Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, MateriaLegislativa,
@ -16,6 +16,7 @@ from sapl.materia.models import (Anexada, Autoria, DespachoInicial,
Tramitacao, UnidadeTramitacao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica)
from sapl.parlamentares.models import Legislatura
from sapl.utils import models_with_gr_for_model
@ -509,11 +510,10 @@ def test_form_errors_proposicao(admin_client):
['Este campo é obrigatório.'])
@pytest.mark.django_db(transaction=False)
def test_numeracao_materia_legislativa_por_legislatura(admin_client):
#Criar Legislaturas
# Criar Legislaturas
legislatura1 = mommy.make(Legislatura,
data_inicio='2014-01-01',
data_fim='2018-12-31',
@ -527,9 +527,8 @@ def test_numeracao_materia_legislativa_por_legislatura(admin_client):
data_eleicao='2018-10-15'
)
# Cria uma materia na legislatura1
tipo_materia = mommy.make(TipoMateriaLegislativa, id=1,sequencia_numeracao='L')
tipo_materia = mommy.make(TipoMateriaLegislativa, id=1, sequencia_numeracao='L')
materia = mommy.make(MateriaLegislativa,
tipo=tipo_materia,
ano=2017,
@ -557,14 +556,13 @@ def test_numeracao_materia_legislativa_por_legislatura(admin_client):
def test_numeracao_materia_legislativa_por_ano(admin_client):
# Cria uma materia
tipo_materia = mommy.make(TipoMateriaLegislativa, id=1,sequencia_numeracao='A')
tipo_materia = mommy.make(TipoMateriaLegislativa, id=1, sequencia_numeracao='A')
materia = mommy.make(MateriaLegislativa,
tipo=tipo_materia,
ano=2017,
numero=1
)
url = reverse('sapl.materia:recuperar_materia')
# Testa numeração da Materia Legislativa no ano da materia criada

1
sapl/materia/tests/test_materia_form.py

@ -1,6 +1,7 @@
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

3
sapl/materia/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.materia.views import (AcompanhamentoConfirmarView,
AcompanhamentoExcluirView,
AcompanhamentoMateriaView, AnexadaCrud,
@ -62,7 +63,7 @@ urlpatterns_materia = [
url(r'^materia/(?P<pk>[0-9]+)/create_simplificado$',
CriarProtocoloMateriaView.as_view(),
name='materia_create_simplificado'),
url(r'^materia/recuperar-materia',recuperar_materia, name='recuperar_materia'),
url(r'^materia/recuperar-materia', recuperar_materia, name='recuperar_materia'),
url(r'^materia/(?P<pk>[0-9]+)/ta$',
MateriaTaView.as_view(), name='materia_ta'),

5
sapl/materia/views.py

@ -2,6 +2,7 @@ from datetime import datetime
from random import choice
from string import ascii_letters, digits
import weasyprint
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML
from django.contrib import messages
@ -22,8 +23,8 @@ 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
import sapl
from sapl.base.models import Autor, CasaLegislativa
from sapl.comissoes.models import Comissao, Participacao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT,
@ -47,7 +48,6 @@ from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label,
autor_modal, gerar_hash_arquivo, get_base_url,
get_mime_type_from_file_extension, montar_row_autor,
show_results_filter_set)
import sapl
from .email_utils import do_envia_email_confirmacao
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
@ -68,7 +68,6 @@ from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria,
TipoProposicao, Tramitacao, UnidadeTramitacao)
from .signals import tramitacao_signal
AssuntoMateriaCrud = CrudAux.build(AssuntoMateria, 'assunto_materia')
OrigemCrud = CrudAux.build(Origem, '')

1
sapl/norma/forms.py

@ -8,6 +8,7 @@ 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

1
sapl/norma/tests/test_norma.py

@ -2,6 +2,7 @@ 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, NormaPesquisaSimplesForm,
NormaRelacionadaForm)

1
sapl/norma/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView,
NormaRelacionadaCrud, NormaTaView, TipoNormaCrud,
TipoVinculoNormaJuridicaCrud, recuperar_norma,

1
sapl/norma/views.py

@ -11,6 +11,7 @@ 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
from sapl.base.models import AppConfig
from sapl.compilacao.views import IntegracaoTaView
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,

1
sapl/painel/views.py

@ -11,6 +11,7 @@ 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

1
sapl/parlamentares/forms.py

@ -14,6 +14,7 @@ from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from floppyforms.widgets import ClearableFileInput
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

1
sapl/parlamentares/models.py

@ -5,6 +5,7 @@ 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
from sapl.base.models import Autor
from sapl.decorators import vigencia_atual
from sapl.utils import (INDICADOR_AFASTAMENTO, LISTA_DE_UFS, YES_NO_CHOICES,

1
sapl/parlamentares/tests/test_mandato.py

@ -2,6 +2,7 @@ from datetime import datetime
import pytest
from model_mommy import mommy
from sapl.parlamentares.models import Filiacao, Legislatura, Mandato
pytestmark = pytest.mark.django_db

1
sapl/parlamentares/tests/test_parlamentares.py

@ -2,6 +2,7 @@ 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,

1
sapl/parlamentares/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud,
ComposicaoColigacaoCrud, DependenteCrud,
FiliacaoCrud, FrenteCrud, FrenteList,

3
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
@ -33,7 +33,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa,
SituacaoMilitar, TipoAfastamento, TipoDependente, Votante)
CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa')
PartidoCrud = CrudAux.build(Partido, 'partidos')
SessaoLegislativaCrud = CrudAux.build(SessaoLegislativa, 'sessao_legislativa')

15
sapl/protocoloadm/forms.py

@ -10,12 +10,13 @@ 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,
UnidadeTramitacao)
from sapl.utils import (RANGE_ANOS, AnoNumeroOrderingFilter,
RangeWidgetOverride, autor_label, autor_modal, YES_NO_CHOICES)
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, AnoNumeroOrderingFilter,
RangeWidgetOverride, autor_label, autor_modal)
from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo,
Protocolo, TipoDocumentoAdministrativo,
@ -363,7 +364,6 @@ class ProtocoloMateriaForm(ModelForm):
empty_label='Selecione',
)
numero_materia = forms.CharField(
label=_('Número matéria'), required=False)
@ -372,7 +372,7 @@ class ProtocoloMateriaForm(ModelForm):
vincular_materia = forms.ChoiceField(label=_('Vincular a matéria existente?'),
widget=forms.RadioSelect(),
choices= YES_NO_CHOICES,
choices=YES_NO_CHOICES,
initial=False)
numero_paginas = forms.CharField(label=_('Núm. Páginas'), required=True)
@ -414,7 +414,8 @@ class ProtocoloMateriaForm(ModelForm):
if data['vincular_materia'] == 'True':
try:
if not data['ano_materia'] or not data['numero_materia']:
raise ValidationError('Favor informar o número e ano da matéria a ser vinculada')
raise ValidationError(
'Favor informar o número e ano da matéria a ser vinculada')
self.materia = MateriaLegislativa.objects.get(ano=data['ano_materia'],
numero=data['numero_materia'],
tipo=data['tipo_materia'])
@ -426,8 +427,6 @@ class ProtocoloMateriaForm(ModelForm):
return data
def __init__(self, *args, **kwargs):
row1 = to_row(
@ -438,7 +437,7 @@ class ProtocoloMateriaForm(ModelForm):
row2 = to_row(
[('vincular_materia', 4),
('numero_materia', 4),
('ano_materia', 4),])
('ano_materia', 4), ])
row3 = to_row(
[('assunto_ementa', 12)])
row4 = to_row(

1
sapl/protocoloadm/models.py

@ -2,6 +2,7 @@ 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

1
sapl/protocoloadm/tests/test_protocoloadm.py

@ -5,6 +5,7 @@ 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,

1
sapl/protocoloadm/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.protocoloadm.views import (AnularProtocoloAdmView,
ComprovanteProtocoloView,
CriarDocumentoProtocolo,

3
sapl/protocoloadm/views.py

@ -1,5 +1,4 @@
import sapl
from braces.views import FormValidMessageMixin
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
@ -15,6 +14,8 @@ 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

2
sapl/redireciona_urls/views.py

@ -1,5 +1,6 @@
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
@ -635,6 +636,7 @@ class RedirecionaMateriasPorAnoAutorTipo(RedirectView):
return url
class RedirecionaReuniao(RedirectView):
permanent = True

7
sapl/relatorios/views.py

@ -6,6 +6,7 @@ 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,
@ -947,8 +948,8 @@ def get_etiqueta_protocolos(prots):
dic['num_materia'] = ''
for materia in MateriaLegislativa.objects.filter(
numero_protocolo=p.numero, ano=p.ano):
dic['num_materia'] = materia.tipo.sigla + ' ' + str(materia.numero) + '/' + str(materia.ano)
dic['num_materia'] = materia.tipo.sigla + ' ' + \
str(materia.numero) + '/' + str(materia.ano)
dic['natureza'] = ''
if p.tipo_processo == 0:
@ -959,8 +960,6 @@ def get_etiqueta_protocolos(prots):
else:
dic['natureza'] = 'Legislativo'
dic['num_documento'] = ''
for documento in DocumentoAdministrativo.objects.filter(
protocolo=p):

1
sapl/rules/apps.py

@ -10,6 +10,7 @@ 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,

1
sapl/rules/tests/test_rules.py

@ -5,6 +5,7 @@ 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,

1
sapl/sessao/forms.py

@ -9,6 +9,7 @@ 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

1
sapl/sessao/tests/test_sessao_view.py

@ -2,6 +2,7 @@ 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

1
sapl/sessao/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from sapl.sessao.views import (AdicionarVariasMateriasExpediente,
AdicionarVariasMateriasOrdemDia, BancadaCrud,
BlocoCrud, CargoBancadaCrud,

1
sapl/sessao/views.py

@ -20,6 +20,7 @@ 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,

1
sapl/test_crispy_layout_mixin.py

@ -1,6 +1,7 @@
from unittest import mock
import rtyaml
from sapl.crispy_layout_mixin import read_layout_from_yaml

5
sapl/test_urls.py

@ -1,12 +1,12 @@
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
@ -14,7 +14,6 @@ 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]

13
sapl/urls.py

@ -13,6 +13,13 @@ 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
@ -26,12 +33,6 @@ 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'),

11
sapl/utils.py

@ -1,11 +1,13 @@
from functools import wraps
from operator import itemgetter
from unicodedata import normalize as unicodedata_normalize
import hashlib
import logging
import os
import re
from functools import wraps
from operator import itemgetter
from unicodedata import normalize as unicodedata_normalize
import django_filters
import magic
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button
from django import forms
@ -23,13 +25,10 @@ from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput
from reversion.admin import VersionAdmin
from unipath.path import Path
import django_filters
import magic
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.settings import BASE_DIR
sapl_logger = logging.getLogger(BASE_DIR.name)

1
scripts/anonimizador/anon.py

@ -5,6 +5,7 @@ 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

1
scripts/convert_null_to_empty_in_all_char_fields.py

@ -1,5 +1,6 @@
from django.apps import apps
from django.db import models
from sapl.settings import SAPL_APPS

1
scripts/fk_protocoloadm_docadm.py

@ -3,6 +3,7 @@
from django.core.exceptions import ObjectDoesNotExist
from sapl.protocoloadm.models import DocumentoAdministrativo, Protocolo

Loading…
Cancel
Save