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. 36
      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. 23
      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. 11
      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. 2
      sapl/legacy/test_migration.py
  34. 1
      sapl/lexml/urls.py
  35. 5
      sapl/materia/admin.py
  36. 1
      sapl/materia/email_utils.py
  37. 13
      sapl/materia/forms.py
  38. 2
      sapl/materia/models.py
  39. 1
      sapl/materia/receivers.py
  40. 1
      sapl/materia/tests/test_email_templates.py
  41. 50
      sapl/materia/tests/test_materia.py
  42. 1
      sapl/materia/tests/test_materia_form.py
  43. 3
      sapl/materia/urls.py
  44. 5
      sapl/materia/views.py
  45. 1
      sapl/norma/forms.py
  46. 1
      sapl/norma/tests/test_norma.py
  47. 1
      sapl/norma/urls.py
  48. 1
      sapl/norma/views.py
  49. 1
      sapl/painel/views.py
  50. 1
      sapl/parlamentares/forms.py
  51. 1
      sapl/parlamentares/models.py
  52. 1
      sapl/parlamentares/tests/test_mandato.py
  53. 1
      sapl/parlamentares/tests/test_parlamentares.py
  54. 1
      sapl/parlamentares/urls.py
  55. 3
      sapl/parlamentares/views.py
  56. 15
      sapl/protocoloadm/forms.py
  57. 1
      sapl/protocoloadm/models.py
  58. 1
      sapl/protocoloadm/tests/test_protocoloadm.py
  59. 1
      sapl/protocoloadm/urls.py
  60. 3
      sapl/protocoloadm/views.py
  61. 2
      sapl/redireciona_urls/views.py
  62. 7
      sapl/relatorios/views.py
  63. 1
      sapl/rules/apps.py
  64. 1
      sapl/rules/tests/test_rules.py
  65. 1
      sapl/sessao/forms.py
  66. 1
      sapl/sessao/tests/test_sessao_view.py
  67. 1
      sapl/sessao/urls.py
  68. 1
      sapl/sessao/views.py
  69. 1
      sapl/test_crispy_layout_mixin.py
  70. 5
      sapl/test_urls.py
  71. 13
      sapl/urls.py
  72. 13
      sapl/utils.py
  73. 1
      scripts/anonimizador/anon.py
  74. 1
      scripts/convert_null_to_empty_in_all_char_fields.py
  75. 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 import serializers
from rest_framework.compat import django_filters from rest_framework.compat import django_filters
from rest_framework.filters import FilterSet from rest_framework.filters import FilterSet
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura from sapl.parlamentares.models import Legislatura
from sapl.utils import generic_relations_for_model from sapl.utils import generic_relations_for_model

1
sapl/api/serializers.py

@ -1,4 +1,5 @@
from rest_framework import serializers from rest_framework import serializers
from sapl.base.models import Autor, CasaLegislativa from sapl.base.models import Autor, CasaLegislativa
from sapl.materia.models import MateriaLegislativa from sapl.materia.models import MateriaLegislativa
from sapl.sessao.models import OrdemDia, SessaoPlenaria from sapl.sessao.models import OrdemDia, SessaoPlenaria

1
sapl/api/urls.py

@ -1,6 +1,7 @@
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url from django.conf.urls import include, url
from rest_framework.routers import DefaultRouter from rest_framework.routers import DefaultRouter
from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView, from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView,
AutorListView, MateriaLegislativaViewSet, AutorListView, MateriaLegislativaViewSet,
ModelChoiceView, SessaoPlenariaViewSet) 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, from rest_framework.permissions import (AllowAny, IsAuthenticated,
IsAuthenticatedOrReadOnly) IsAuthenticatedOrReadOnly)
from rest_framework.viewsets import GenericViewSet from rest_framework.viewsets import GenericViewSet
from sapl.api.forms import (AutorChoiceFilterSet, AutoresPossiveisFilterSet, from sapl.api.forms import (AutorChoiceFilterSet, AutoresPossiveisFilterSet,
AutorSearchForFieldFilterSet) AutorSearchForFieldFilterSet)
from sapl.api.serializers import (AutorChoiceSerializer, AutorSerializer, 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.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from reversion.models import Revision from reversion.models import Revision
from sapl.base.models import ProblemaMigracao from sapl.base.models import ProblemaMigracao
from sapl.utils import register_all_models_in_admin from sapl.utils import register_all_models_in_admin

36
sapl/base/forms.py

@ -13,16 +13,17 @@ from django.db import models, transaction
from django.forms import Form, ModelForm from django.forms import Form, ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat from django.utils.translation import string_concat
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column, from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column,
to_row) to_row)
from sapl.materia.models import MateriaLegislativa from sapl.materia.models import MateriaLegislativa
from sapl.sessao.models import SessaoPlenaria from sapl.sessao.models import SessaoPlenaria
from sapl.settings import MAX_IMAGE_UPLOAD_SIZE from sapl.settings import MAX_IMAGE_UPLOAD_SIZE
from sapl.utils import (RANGE_ANOS, ChoiceWithoutValidationField, from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
ImageThumbnailFileInput, RangeWidgetOverride, ChoiceWithoutValidationField, ImageThumbnailFileInput,
autor_label, autor_modal, models_with_gr_for_model, RangeWidgetOverride, autor_label, autor_modal,
qs_override_django_filter, YES_NO_CHOICES) models_with_gr_for_model, qs_override_django_filter)
from .models import AppConfig, CasaLegislativa from .models import AppConfig, CasaLegislativa
@ -40,8 +41,10 @@ STATUS_USER_CHOICE = [
('X', _('Excluir Usuário')), ('X', _('Excluir Usuário')),
] ]
def get_roles(): def get_roles():
return [(g.id, g.name) for g in Group.objects.all().order_by('name')] return [(g.id, g.name) for g in Group.objects.all().order_by('name')]
class UsuarioCreateForm(ModelForm): class UsuarioCreateForm(ModelForm):
@ -50,16 +53,18 @@ class UsuarioCreateForm(ModelForm):
lastname = forms.CharField(required=True, label="Sobrenome") lastname = forms.CharField(required=True, label="Sobrenome")
password1 = forms.CharField(required=True, widget=forms.PasswordInput, label='Senha') password1 = forms.CharField(required=True, widget=forms.PasswordInput, label='Senha')
password2 = forms.CharField(required=True, widget=forms.PasswordInput, label='Confirmar 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 = [(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: class Meta:
model = get_user_model() 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): def clean(self):
super(UsuarioCreateForm, self).clean() super(UsuarioCreateForm, self).clean()
@ -69,7 +74,7 @@ class UsuarioCreateForm(ModelForm):
data = self.cleaned_data data = self.cleaned_data
if data['password1'] != data['password2']: if data['password1'] != data['password2']:
raise ValidationError('Senhas informadas são diferentes') raise ValidationError('Senhas informadas são diferentes')
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -97,6 +102,7 @@ class UsuarioCreateForm(ModelForm):
'roles', 'roles',
row4) row4)
class UsuarioEditForm(ModelForm): class UsuarioEditForm(ModelForm):
# ROLES = [(g.id, g.name) for g in Group.objects.all().order_by('name')] # 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') password1 = forms.CharField(required=False, widget=forms.PasswordInput, label='Senha')
password2 = forms.CharField(required=False, widget=forms.PasswordInput, label='Confirmar 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') user_active = forms.ChoiceField(choices=YES_NO_CHOICES, required=True,
roles = forms.MultipleChoiceField(required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles) label="Usuário ativo?", initial='True')
roles = forms.MultipleChoiceField(
required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles)
class Meta: class Meta:
model = get_user_model() model = get_user_model()
@ -121,7 +129,6 @@ class UsuarioEditForm(ModelForm):
[('password1', 6), [('password1', 6),
('password2', 6)]) ('password2', 6)])
row3 = to_row([(form_actions(label='Salvar Alterações'), 6)]) row3 = to_row([(form_actions(label='Salvar Alterações'), 6)])
self.helper = FormHelper() self.helper = FormHelper()
@ -139,7 +146,7 @@ class UsuarioEditForm(ModelForm):
data = self.cleaned_data data = self.cleaned_data
if data['password1'] and data['password1'] != data['password2']: if data['password1'] and data['password1'] != data['password2']:
raise ValidationError('Senhas informadas são diferentes') raise ValidationError('Senhas informadas são diferentes')
class TipoAutorForm(ModelForm): class TipoAutorForm(ModelForm):
@ -572,6 +579,7 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet):
form_actions(label='Pesquisar')) form_actions(label='Pesquisar'))
) )
class RelatorioDataFimPrazoTramitacaoFilterSet(django_filters.FilterSet): class RelatorioDataFimPrazoTramitacaoFilterSet(django_filters.FilterSet):
filter_overrides = {models.DateField: { 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.fields import CharField
from haystack.indexes import SearchIndex from haystack.indexes import SearchIndex
from haystack.utils import get_model_ct_tuple from haystack.utils import get_model_ct_tuple
from textract.exceptions import ExtensionNotSupported
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_PUBLIC, Dispositivo, STATUS_TA_PUBLIC, Dispositivo,
TextoArticulado) TextoArticulado)
from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa
from sapl.norma.models import NormaJuridica from sapl.norma.models import NormaJuridica
from sapl.settings import BASE_DIR, SOLR_URL from sapl.settings import BASE_DIR, SOLR_URL
from textract.exceptions import ExtensionNotSupported
logger = logging.getLogger(BASE_DIR.name) logger = logging.getLogger(BASE_DIR.name)

3
sapl/base/templatetags/common_tags.py

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

4
sapl/base/templatetags/menus.py

@ -1,9 +1,9 @@
import yaml
from django import template from django import template
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ 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() register = template.Library()

1
sapl/base/tests/test_form.py

@ -1,5 +1,6 @@
import pytest import pytest
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.forms import CasaLegislativaForm 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.conf.urls import patterns, url
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from sapl.urls import urlpatterns as original_patterns from sapl.urls import urlpatterns as original_patterns
ptrn = 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_confirm,
password_reset_done) password_reset_done)
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from sapl.base.views import AutorCrud, ConfirmarEmailView, TipoAutorCrud from sapl.base.views import AutorCrud, ConfirmarEmailView, TipoAutorCrud
from sapl.settings import EMAIL_SEND_USER from sapl.settings import EMAIL_SEND_USER
from .apps import AppConfig from .apps import AppConfig
from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm
from .views import (AlterarSenha, AppConfigCrud, CasaLegislativaCrud, from .views import (AlterarSenha, AppConfigCrud, CasaLegislativaCrud,
HelpTopicView, RelatorioAtasView, CreateUsuarioView, DeleteUsuarioView, EditUsuarioView,
HelpTopicView, ListarUsuarioView, RelatorioAtasView,
RelatorioDataFimPrazoTramitacaoView,
RelatorioHistoricoTramitacaoView, RelatorioHistoricoTramitacaoView,
RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAnoAutorTipoView,
RelatorioMateriasPorAutorView, RelatorioMateriasPorAutorView,
RelatorioMateriasTramitacaoView, RelatorioMateriasTramitacaoView,
RelatorioPresencaSessaoView, SaplSearchView, RelatorioPresencaSessaoView, SaplSearchView)
RelatorioDataFimPrazoTramitacaoView, ListarUsuarioView, EditUsuarioView, CreateUsuarioView,
DeleteUsuarioView)
app_name = AppConfig.name 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.http import urlsafe_base64_decode, urlsafe_base64_encode
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat 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.views.generic.base import TemplateView
from django_filters.views import FilterView from django_filters.views import FilterView
from haystack.views import SearchView from haystack.views import SearchView
from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm
from sapl.base.models import Autor, TipoAutor 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, from sapl.materia.models import (Autoria, MateriaLegislativa,
TipoMateriaLegislativa) TipoMateriaLegislativa)
from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria, from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria,
@ -30,12 +32,13 @@ from sapl.utils import (parlamentares_ativos, sapl_logger,
from .forms import (AlterarSenhaForm, CasaLegislativaForm, from .forms import (AlterarSenhaForm, CasaLegislativaForm,
ConfiguracoesAppForm, RelatorioAtasFilterSet, ConfiguracoesAppForm, RelatorioAtasFilterSet,
RelatorioDataFimPrazoTramitacaoFilterSet,
RelatorioHistoricoTramitacaoFilterSet, RelatorioHistoricoTramitacaoFilterSet,
RelatorioMateriasPorAnoAutorTipoFilterSet, RelatorioMateriasPorAnoAutorTipoFilterSet,
RelatorioMateriasPorAutorFilterSet, RelatorioMateriasPorAutorFilterSet,
RelatorioMateriasTramitacaoilterSet, RelatorioMateriasTramitacaoilterSet,
RelatorioPresencaSessaoFilterSet, RelatorioPresencaSessaoFilterSet, UsuarioCreateForm,
RelatorioDataFimPrazoTramitacaoFilterSet, UsuarioEditForm, UsuarioCreateForm) UsuarioEditForm)
from .models import AppConfig, CasaLegislativa from .models import AppConfig, CasaLegislativa
@ -70,6 +73,7 @@ class TipoAutorCrud(CrudAux):
return vn return vn
class ListView(CrudAux.ListView): class ListView(CrudAux.ListView):
def get_queryset(self): def get_queryset(self):
qs = CrudAux.ListView.get_queryset(self) qs = CrudAux.ListView.get_queryset(self)
qs = qs.filter(content_type__isnull=True) qs = qs.filter(content_type__isnull=True)
@ -84,6 +88,7 @@ class TipoAutorCrud(CrudAux):
return context return context
class TipoAutorMixin: class TipoAutorMixin:
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
object = self.get_object() object = self.get_object()
if object.content_type: if object.content_type:
@ -359,6 +364,7 @@ class RelatorioHistoricoTramitacaoView(FilterView):
return context return context
class RelatorioDataFimPrazoTramitacaoView(FilterView): class RelatorioDataFimPrazoTramitacaoView(FilterView):
model = MateriaLegislativa model = MateriaLegislativa
filterset_class = RelatorioDataFimPrazoTramitacaoFilterSet filterset_class = RelatorioDataFimPrazoTramitacaoFilterSet
@ -569,6 +575,7 @@ class CreateUsuarioView(PermissionRequiredMixin, CreateView):
return HttpResponseRedirect(self.get_success_url()) return HttpResponseRedirect(self.get_success_url())
class DeleteUsuarioView(PermissionRequiredMixin, DeleteView): class DeleteUsuarioView(PermissionRequiredMixin, DeleteView):
model = get_user_model() model = get_user_model()
@ -585,7 +592,6 @@ class DeleteUsuarioView(PermissionRequiredMixin, DeleteView):
return qs.filter(id=self.kwargs['pk']) return qs.filter(id=self.kwargs['pk'])
class EditUsuarioView(PermissionRequiredMixin, UpdateView): class EditUsuarioView(PermissionRequiredMixin, UpdateView):
model = get_user_model() model = get_user_model()
form_class = UsuarioEditForm 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.db.models import Q
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao
from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar 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.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_utils import Choices from model_utils import Choices
import reversion
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.parlamentares.models import Parlamentar from sapl.parlamentares.models import Parlamentar

1
sapl/comissoes/tests/test_comissoes.py

@ -1,6 +1,7 @@
import pytest import pytest
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from model_mommy import mommy from model_mommy import mommy
from sapl.comissoes.models import Comissao, Composicao, Periodo, TipoComissao from sapl.comissoes.models import Comissao, Composicao, Periodo, TipoComissao
from sapl.parlamentares.models import Filiacao, Parlamentar, Partido 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 django.conf.urls import include, url
from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud, from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud,
MateriasTramitacaoListView, ParticipacaoCrud, MateriasTramitacaoListView, ParticipacaoCrud,
PeriodoComposicaoCrud, ReuniaoCrud, TipoComissaoCrud) PeriodoComposicaoCrud, ReuniaoCrud,
TipoComissaoCrud)
from .apps import AppConfig from .apps import AppConfig

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

6
sapl/compilacao/apps.py

@ -2,10 +2,10 @@ import logging
from django import apps from django import apps
from django.conf import settings 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.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 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.forms.models import ModelForm
from django.template import defaultfilters from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl import utils from sapl import utils
from sapl.compilacao.models import (NOTAS_PUBLICIDADE_CHOICES, from sapl.compilacao.models import (NOTAS_PUBLICIDADE_CHOICES,
PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, PARTICIPACAO_SOCIAL_CHOICES, Dispositivo,

2
sapl/compilacao/models.py

@ -1,4 +1,5 @@
import reversion
from django.contrib import messages from django.contrib import messages
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType 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.decorators import classonlymethod
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import reversion
from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter, from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter,
int_to_roman) 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.db.models import Q
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.compilacao.models import Dispositivo from sapl.compilacao.models import Dispositivo
register = template.Library() 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 django.utils.translation import ugettext as _
from model_mommy import mommy from model_mommy import mommy
import pytest
from sapl.compilacao import forms from sapl.compilacao import forms
from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota

11
sapl/compilacao/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.compilacao import views from sapl.compilacao import views
from sapl.compilacao.views import (TipoDispositivoCrud, TipoNotaCrud, from sapl.compilacao.views import (TipoDispositivoCrud, TipoNotaCrud,
TipoPublicacaoCrud, TipoVideCrud, TipoPublicacaoCrud, TipoVideCrud,
@ -116,13 +117,13 @@ urlpatterns = [
include(TipoDispositivoCrud.get_urls())), include(TipoDispositivoCrud.get_urls())),
url(r'^sistema/ta/config/tipo-textoarticulado$', url(r'^sistema/ta/config/tipo-textoarticulado$',
views.TipoTaListView.as_view(), name='tipo_ta_list'), views.TipoTaListView.as_view(), name='tipo_ta_list'),
url(r'^sistema/ta/config/tipo-textoarticulado/create$', url(r'^sistema/ta/config/tipo-textoarticulado/create$',
views.TipoTaCreateView.as_view(), name='tipo_ta_create'), views.TipoTaCreateView.as_view(), name='tipo_ta_create'),
url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)$', url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)$',
views.TipoTaDetailView.as_view(), name='tipo_ta_detail'), views.TipoTaDetailView.as_view(), name='tipo_ta_detail'),
url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)/edit$', url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)/edit$',
views.TipoTaUpdateView.as_view(), name='tipo_ta_edit'), views.TipoTaUpdateView.as_view(), name='tipo_ta_edit'),
url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)/delete$', url(r'^sistema/ta/config/tipo-textoarticulado/(?P<pk>[0-9]+)/delete$',
views.TipoTaDeleteView.as_view(), name='tipo_ta_delete'), views.TipoTaDeleteView.as_view(), name='tipo_ta_delete'),
] ]

9
sapl/compilacao/views.py

@ -1,7 +1,7 @@
from collections import OrderedDict
from datetime import timedelta
import logging import logging
import sys import sys
from collections import OrderedDict
from datetime import timedelta
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from django import forms 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.shortcuts import get_object_or_404, redirect
from django.utils.dateparse import parse_date from django.utils.dateparse import parse_date
from django.utils.encoding import force_text 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 ugettext_lazy as _
from django.utils.translation import string_concat
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import (CreateView, DeleteView, FormView, 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, from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED,
DISPOSITIVO_SELECT_RELATED_EDIT, DISPOSITIVO_SELECT_RELATED_EDIT,
get_integrations_view_names) 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 from sapl.settings import BASE_DIR
TipoNotaCrud = CrudAux.build(TipoNota, 'tipo_nota') TipoNotaCrud = CrudAux.build(TipoNota, 'tipo_nota')
TipoVideCrud = CrudAux.build(TipoVide, 'tipo_vide') TipoVideCrud = CrudAux.build(TipoVide, 'tipo_vide')
TipoPublicacaoCrud = CrudAux.build(TipoPublicacao, 'tipo_publicacao') TipoPublicacaoCrud = CrudAux.build(TipoPublicacao, 'tipo_publicacao')

2
sapl/crispy_layout_mixin.py

@ -1,5 +1,6 @@
from math import ceil from math import ceil
import rtyaml
from crispy_forms.bootstrap import FormActions from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit 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.core.urlresolvers import reverse, reverse_lazy
from django.utils import formats from django.utils import formats
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
import rtyaml
def heads_and_tails(list_of_lists): 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.shortcuts import redirect
from django.utils.decorators import classonlymethod from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text 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 ugettext_lazy as _
from django.utils.translation import string_concat
from django.views.generic import (CreateView, DeleteView, DetailView, ListView, from django.views.generic import (CreateView, DeleteView, DetailView, ListView,
UpdateView) UpdateView)
from django.views.generic.base import ContextMixin 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.settings import BASE_DIR
from sapl.utils import normalize from sapl.utils import normalize
logger = logging.getLogger(BASE_DIR.name) logger = logging.getLogger(BASE_DIR.name)
ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \ ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \

1
sapl/crud/tests/test_base.py

@ -1,6 +1,7 @@
import pytest import pytest
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from model_mommy import mommy from model_mommy import mommy
from sapl.crud.base import (CrispyLayoutFormMixin, CrudListView, from_to, from sapl.crud.base import (CrispyLayoutFormMixin, CrudListView, from_to,
get_field_display, make_pagination) get_field_display, make_pagination)
from sapl.crud.tests.stub_app.models import Continent, Country 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 django.core.management.base import BaseCommand
from sapl.legacy.migracao_documentos import migrar_documentos 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 magic
import yaml import yaml
import ZODB.DB import ZODB.DB
import ZODB.FileStorage import ZODB.FileStorage
from ZODB.broken import Broken from ZODB.broken import Broken

2
sapl/legacy/scripts/scrap_original_forms.py

@ -7,8 +7,8 @@ import pkg_resources
import yaml import yaml
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from bs4.element import NavigableString, Tag 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.crispy_layout_mixin import heads_and_tails
from sapl.legacy.migracao import appconfs, get_renames from sapl.legacy.migracao import appconfs, get_renames
from sapl.legacy.scripts.utils import getsourcelines from sapl.legacy.scripts.utils import getsourcelines

1
sapl/legacy/scripts/study.py

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

2
sapl/legacy/test_migration.py

@ -1,7 +1,7 @@
from random import shuffle from random import shuffle
from .migracao import (_formatar_lista_para_sql, get_autorias_sem_repeticoes, from .migracao import (_formatar_lista_para_sql, get_autorias_sem_repeticoes,
get_reapontamento_de_autores_repetidos) get_reapontamento_de_autores_repetidos)
def test_unifica_autores_repetidos_no_legado(): def test_unifica_autores_repetidos_no_legado():

1
sapl/lexml/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud
from .apps import AppConfig 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.base.models import TipoAutor
from sapl.comissoes.models import TipoComissao from sapl.comissoes.models import TipoComissao
from sapl.materia.models import Proposicao from sapl.materia.models import Proposicao
from sapl.parlamentares.models import TipoAfastamento, SituacaoMilitar, \ from sapl.parlamentares.models import (SituacaoMilitar, TipoAfastamento,
TipoDependente TipoDependente)
from sapl.utils import register_all_models_in_admin from sapl.utils import register_all_models_in_admin
register_all_models_in_admin(__name__) register_all_models_in_admin(__name__)
if not settings.DEBUG: 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.core.urlresolvers import reverse
from django.template import Context, loader from django.template import Context, loader
from django.utils import timezone from django.utils import timezone
from sapl.base.models import CasaLegislativa from sapl.base.models import CasaLegislativa
from sapl.settings import EMAIL_SEND_USER from sapl.settings import EMAIL_SEND_USER

13
sapl/materia/forms.py

@ -1,7 +1,7 @@
import os import os
import django_filters import django_filters
import sapl
from crispy_forms.bootstrap import Alert, FormActions, InlineRadios from crispy_forms.bootstrap import Alert, FormActions, InlineRadios
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, 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.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ 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.comissoes.models import Comissao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_PRIVATE) STATUS_TA_PRIVATE)
@ -39,8 +41,8 @@ from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
ChoiceWithoutValidationField, ChoiceWithoutValidationField,
MateriaPesquisaOrderingFilter, RangeWidgetOverride, MateriaPesquisaOrderingFilter, RangeWidgetOverride,
autor_label, autor_modal, models_with_gr_for_model, autor_label, autor_modal, gerar_hash_arquivo,
qs_override_django_filter, gerar_hash_arquivo) models_with_gr_for_model, qs_override_django_filter)
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, Numeracao, Proposicao, Relatoria, DocumentoAcessorio, Numeracao, Proposicao, Relatoria,
@ -1135,7 +1137,7 @@ class ProposicaoForm(forms.ModelForm):
widgets = { widgets = {
'descricao': widgets.Textarea(attrs={'rows': 4}), 'descricao': widgets.Textarea(attrs={'rows': 4}),
'tipo': TipoProposicaoSelect(), 'tipo': TipoProposicaoSelect(),
'hash_code': forms.HiddenInput(),} 'hash_code': forms.HiddenInput(), }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.texto_articulado_proposicao = sapl.base.models.AppConfig.attr( self.texto_articulado_proposicao = sapl.base.models.AppConfig.attr(
@ -1222,7 +1224,6 @@ class ProposicaoForm(forms.ModelForm):
# FIXME hash para textos articulados # FIXME hash para textos articulados
inst.hash_code = 'P' + ta.hash() + '/' + str(inst.pk) inst.hash_code = 'P' + ta.hash() + '/' + str(inst.pk)
def clean(self): def clean(self):
super(ProposicaoForm, self).clean() 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 django.utils.translation import ugettext_lazy as _
from model_utils import Choices 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.comissoes.models import Comissao
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado, from sapl.compilacao.models import (PerfilEstruturalTextoArticulado,
TextoArticulado) TextoArticulado)

1
sapl/materia/receivers.py

@ -1,5 +1,6 @@
from django.db.models.signals import post_delete, post_save from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver from django.dispatch import receiver
from sapl.materia.models import Tramitacao from sapl.materia.models import Tramitacao
from sapl.materia.signals import tramitacao_signal from sapl.materia.signals import tramitacao_signal
from sapl.utils import get_base_url 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 django.core import mail
from sapl.materia.email_utils import enviar_emails, load_email_templates from sapl.materia.email_utils import enviar_emails, load_email_templates

50
sapl/materia/tests/test_materia.py

@ -1,12 +1,12 @@
import pytest import pytest
from django.db.models import Max
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db.models import Max
from model_mommy import mommy from model_mommy import mommy
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura
from sapl.comissoes.models import Comissao, TipoComissao from sapl.comissoes.models import Comissao, TipoComissao
from sapl.materia.models import (Anexada, Autoria, DespachoInicial, from sapl.materia.models import (Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, MateriaLegislativa, DocumentoAcessorio, MateriaLegislativa,
@ -16,6 +16,7 @@ from sapl.materia.models import (Anexada, Autoria, DespachoInicial,
Tramitacao, UnidadeTramitacao) Tramitacao, UnidadeTramitacao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica, from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica) TipoNormaJuridica)
from sapl.parlamentares.models import Legislatura
from sapl.utils import models_with_gr_for_model from sapl.utils import models_with_gr_for_model
@ -509,32 +510,30 @@ def test_form_errors_proposicao(admin_client):
['Este campo é obrigatório.']) ['Este campo é obrigatório.'])
@pytest.mark.django_db(transaction=False) @pytest.mark.django_db(transaction=False)
def test_numeracao_materia_legislativa_por_legislatura(admin_client): def test_numeracao_materia_legislativa_por_legislatura(admin_client):
#Criar Legislaturas # Criar Legislaturas
legislatura1 = mommy.make(Legislatura, legislatura1 = mommy.make(Legislatura,
data_inicio='2014-01-01', data_inicio='2014-01-01',
data_fim='2018-12-31', data_fim='2018-12-31',
numero=20, numero=20,
data_eleicao='2013-10-15' data_eleicao='2013-10-15'
) )
legislatura2 = mommy.make(Legislatura, legislatura2 = mommy.make(Legislatura,
data_inicio='2009-01-01', data_inicio='2009-01-01',
data_fim='2013-12-31', data_fim='2013-12-31',
numero=21, numero=21,
data_eleicao='2018-10-15' data_eleicao='2018-10-15'
) )
# Cria uma materia na legislatura1 # 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, materia = mommy.make(MateriaLegislativa,
tipo=tipo_materia, tipo=tipo_materia,
ano=2017, ano=2017,
numero=1 numero=1
) )
url = reverse('sapl.materia:recuperar_materia') url = reverse('sapl.materia:recuperar_materia')
@ -557,13 +556,12 @@ def test_numeracao_materia_legislativa_por_legislatura(admin_client):
def test_numeracao_materia_legislativa_por_ano(admin_client): def test_numeracao_materia_legislativa_por_ano(admin_client):
# Cria uma materia # 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, materia = mommy.make(MateriaLegislativa,
tipo=tipo_materia, tipo=tipo_materia,
ano=2017, ano=2017,
numero=1 numero=1
) )
url = reverse('sapl.materia:recuperar_materia') url = reverse('sapl.materia:recuperar_materia')

1
sapl/materia/tests/test_materia_form.py

@ -1,6 +1,7 @@
import pytest import pytest
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from model_mommy import mommy from model_mommy import mommy
from sapl.materia import forms from sapl.materia import forms
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa

3
sapl/materia/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.materia.views import (AcompanhamentoConfirmarView, from sapl.materia.views import (AcompanhamentoConfirmarView,
AcompanhamentoExcluirView, AcompanhamentoExcluirView,
AcompanhamentoMateriaView, AnexadaCrud, AcompanhamentoMateriaView, AnexadaCrud,
@ -62,7 +63,7 @@ urlpatterns_materia = [
url(r'^materia/(?P<pk>[0-9]+)/create_simplificado$', url(r'^materia/(?P<pk>[0-9]+)/create_simplificado$',
CriarProtocoloMateriaView.as_view(), CriarProtocoloMateriaView.as_view(),
name='materia_create_simplificado'), 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$', url(r'^materia/(?P<pk>[0-9]+)/ta$',
MateriaTaView.as_view(), name='materia_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 random import choice
from string import ascii_letters, digits from string import ascii_letters, digits
import weasyprint
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML from crispy_forms.layout import HTML
from django.contrib import messages 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.base import RedirectView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from django_filters.views import FilterView from django_filters.views import FilterView
import weasyprint
import sapl
from sapl.base.models import Autor, CasaLegislativa from sapl.base.models import Autor, CasaLegislativa
from sapl.comissoes.models import Comissao, Participacao from sapl.comissoes.models import Comissao, Participacao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, 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, autor_modal, gerar_hash_arquivo, get_base_url,
get_mime_type_from_file_extension, montar_row_autor, get_mime_type_from_file_extension, montar_row_autor,
show_results_filter_set) show_results_filter_set)
import sapl
from .email_utils import do_envia_email_confirmacao from .email_utils import do_envia_email_confirmacao
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
@ -68,7 +68,6 @@ from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria,
TipoProposicao, Tramitacao, UnidadeTramitacao) TipoProposicao, Tramitacao, UnidadeTramitacao)
from .signals import tramitacao_signal from .signals import tramitacao_signal
AssuntoMateriaCrud = CrudAux.build(AssuntoMateria, 'assunto_materia') AssuntoMateriaCrud = CrudAux.build(AssuntoMateria, 'assunto_materia')
OrigemCrud = CrudAux.build(Origem, '') 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.forms import ModelForm, widgets
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.crispy_layout_mixin import form_actions, to_row from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.settings import MAX_DOC_UPLOAD_SIZE 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.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy from model_mommy import mommy
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.norma.forms import (NormaJuridicaForm, NormaPesquisaSimplesForm, from sapl.norma.forms import (NormaJuridicaForm, NormaPesquisaSimplesForm,
NormaRelacionadaForm) NormaRelacionadaForm)

1
sapl/norma/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView, from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView,
NormaRelacionadaCrud, NormaTaView, TipoNormaCrud, NormaRelacionadaCrud, NormaTaView, TipoNormaCrud,
TipoVinculoNormaJuridicaCrud, recuperar_norma, 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.base import RedirectView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from django_filters.views import FilterView from django_filters.views import FilterView
from sapl.base.models import AppConfig from sapl.base.models import AppConfig
from sapl.compilacao.views import IntegracaoTaView from sapl.compilacao.views import IntegracaoTaView
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, 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.shortcuts import render
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import AppConfig as ConfiguracoesAplicacao from sapl.base.models import AppConfig as ConfiguracoesAplicacao
from sapl.base.models import CasaLegislativa from sapl.base.models import CasaLegislativa
from sapl.crud.base import Crud 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 django.utils.translation import ugettext_lazy as _
from floppyforms.widgets import ClearableFileInput from floppyforms.widgets import ClearableFileInput
from image_cropping.widgets import CropWidget, ImageCropWidget from image_cropping.widgets import CropWidget, ImageCropWidget
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.rules import SAPL_GROUP_VOTANTE 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 django.utils.translation import ugettext_lazy as _
from image_cropping.fields import ImageCropField, ImageRatioField from image_cropping.fields import ImageCropField, ImageRatioField
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.decorators import vigencia_atual from sapl.decorators import vigencia_atual
from sapl.utils import (INDICADOR_AFASTAMENTO, LISTA_DE_UFS, YES_NO_CHOICES, 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 import pytest
from model_mommy import mommy from model_mommy import mommy
from sapl.parlamentares.models import Filiacao, Legislatura, Mandato from sapl.parlamentares.models import Filiacao, Legislatura, Mandato
pytestmark = pytest.mark.django_db 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.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy from model_mommy import mommy
from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm
from sapl.parlamentares.models import (Dependente, Filiacao, Legislatura, from sapl.parlamentares.models import (Dependente, Filiacao, Legislatura,
Mandato, Parlamentar, Partido, Mandato, Parlamentar, Partido,

1
sapl/parlamentares/urls.py

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

3
sapl/parlamentares/views.py

@ -1,5 +1,5 @@
from datetime import datetime
import json import json
from datetime import datetime
from django.contrib import messages from django.contrib import messages
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
@ -33,7 +33,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa,
SituacaoMilitar, TipoAfastamento, TipoDependente, Votante) SituacaoMilitar, TipoAfastamento, TipoDependente, Votante)
CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa') CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa')
PartidoCrud = CrudAux.build(Partido, 'partidos') PartidoCrud = CrudAux.build(Partido, 'partidos')
SessaoLegislativaCrud = CrudAux.build(SessaoLegislativa, 'sessao_legislativa') 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.forms import ModelForm
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa, from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa,
UnidadeTramitacao) UnidadeTramitacao)
from sapl.utils import (RANGE_ANOS, AnoNumeroOrderingFilter, from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, AnoNumeroOrderingFilter,
RangeWidgetOverride, autor_label, autor_modal, YES_NO_CHOICES) RangeWidgetOverride, autor_label, autor_modal)
from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo,
Protocolo, TipoDocumentoAdministrativo, Protocolo, TipoDocumentoAdministrativo,
@ -363,7 +364,6 @@ class ProtocoloMateriaForm(ModelForm):
empty_label='Selecione', empty_label='Selecione',
) )
numero_materia = forms.CharField( numero_materia = forms.CharField(
label=_('Número matéria'), required=False) label=_('Número matéria'), required=False)
@ -372,7 +372,7 @@ class ProtocoloMateriaForm(ModelForm):
vincular_materia = forms.ChoiceField(label=_('Vincular a matéria existente?'), vincular_materia = forms.ChoiceField(label=_('Vincular a matéria existente?'),
widget=forms.RadioSelect(), widget=forms.RadioSelect(),
choices= YES_NO_CHOICES, choices=YES_NO_CHOICES,
initial=False) initial=False)
numero_paginas = forms.CharField(label=_('Núm. Páginas'), required=True) numero_paginas = forms.CharField(label=_('Núm. Páginas'), required=True)
@ -414,7 +414,8 @@ class ProtocoloMateriaForm(ModelForm):
if data['vincular_materia'] == 'True': if data['vincular_materia'] == 'True':
try: try:
if not data['ano_materia'] or not data['numero_materia']: 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'], self.materia = MateriaLegislativa.objects.get(ano=data['ano_materia'],
numero=data['numero_materia'], numero=data['numero_materia'],
tipo=data['tipo_materia']) tipo=data['tipo_materia'])
@ -426,8 +427,6 @@ class ProtocoloMateriaForm(ModelForm):
return data return data
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
row1 = to_row( row1 = to_row(
@ -438,7 +437,7 @@ class ProtocoloMateriaForm(ModelForm):
row2 = to_row( row2 = to_row(
[('vincular_materia', 4), [('vincular_materia', 4),
('numero_materia', 4), ('numero_materia', 4),
('ano_materia', 4),]) ('ano_materia', 4), ])
row3 = to_row( row3 = to_row(
[('assunto_ementa', 12)]) [('assunto_ementa', 12)])
row4 = to_row( row4 = to_row(

1
sapl/protocoloadm/models.py

@ -2,6 +2,7 @@ import reversion
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.materia.models import TipoMateriaLegislativa, UnidadeTramitacao from sapl.materia.models import TipoMateriaLegislativa, UnidadeTramitacao
from sapl.utils import RANGE_ANOS, YES_NO_CHOICES, texto_upload_path 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.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy from model_mommy import mommy
from sapl.materia.models import UnidadeTramitacao from sapl.materia.models import UnidadeTramitacao
from sapl.protocoloadm.forms import (AnularProcoloAdmForm, from sapl.protocoloadm.forms import (AnularProcoloAdmForm,
DocumentoAdministrativoForm, DocumentoAdministrativoForm,

1
sapl/protocoloadm/urls.py

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

3
sapl/protocoloadm/views.py

@ -1,5 +1,4 @@
import sapl
from braces.views import FormValidMessageMixin from braces.views import FormValidMessageMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin 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 import CreateView, ListView
from django.views.generic.base import RedirectView, TemplateView from django.views.generic.base import RedirectView, TemplateView
from django_filters.views import FilterView from django_filters.views import FilterView
import sapl
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.comissoes.models import Comissao from sapl.comissoes.models import Comissao
from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination 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.core.urlresolvers import NoReverseMatch, reverse
from django.views.generic import RedirectView from django.views.generic import RedirectView
from sapl.base.apps import AppConfig as atasConfig from sapl.base.apps import AppConfig as atasConfig
from sapl.comissoes.apps import AppConfig as comissoesConfig from sapl.comissoes.apps import AppConfig as comissoesConfig
from sapl.materia.apps import AppConfig as materiaConfig from sapl.materia.apps import AppConfig as materiaConfig
@ -635,6 +636,7 @@ class RedirecionaMateriasPorAnoAutorTipo(RedirectView):
return url return url
class RedirecionaReuniao(RedirectView): class RedirecionaReuniao(RedirectView):
permanent = True 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.http import Http404, HttpResponse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, CasaLegislativa from sapl.base.models import Autor, CasaLegislativa
from sapl.comissoes.models import Comissao from sapl.comissoes.models import Comissao
from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao, from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao,
@ -947,8 +948,8 @@ def get_etiqueta_protocolos(prots):
dic['num_materia'] = '' dic['num_materia'] = ''
for materia in MateriaLegislativa.objects.filter( for materia in MateriaLegislativa.objects.filter(
numero_protocolo=p.numero, ano=p.ano): 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'] = '' dic['natureza'] = ''
if p.tipo_processo == 0: if p.tipo_processo == 0:
@ -959,8 +960,6 @@ def get_etiqueta_protocolos(prots):
else: else:
dic['natureza'] = 'Legislativo' dic['natureza'] = 'Legislativo'
dic['num_documento'] = '' dic['num_documento'] = ''
for documento in DocumentoAdministrativo.objects.filter( for documento in DocumentoAdministrativo.objects.filter(
protocolo=p): 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.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat from django.utils.translation import string_concat
from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES, from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES,
SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA, SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA,
SAPL_GROUP_PAINEL, SAPL_GROUP_PROTOCOLO, 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.contrib.contenttypes.models import ContentType
from django.utils import six from django.utils import six
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import (Argumento, CasaLegislativa, Constraint, from sapl.base.models import (Argumento, CasaLegislativa, Constraint,
ProblemaMigracao) ProblemaMigracao)
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado, 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.db import transaction
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.forms import MateriaLegislativaFilterSet 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.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_mommy import mommy from model_mommy import mommy
from sapl.parlamentares.models import Legislatura, SessaoLegislativa from sapl.parlamentares.models import Legislatura, SessaoLegislativa
from sapl.sessao.models import SessaoPlenaria, TipoSessaoPlenaria from sapl.sessao.models import SessaoPlenaria, TipoSessaoPlenaria

1
sapl/sessao/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.sessao.views import (AdicionarVariasMateriasExpediente, from sapl.sessao.views import (AdicionarVariasMateriasExpediente,
AdicionarVariasMateriasOrdemDia, BancadaCrud, AdicionarVariasMateriasOrdemDia, BancadaCrud,
BlocoCrud, CargoBancadaCrud, 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.detail import DetailView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from django_filters.views import FilterView from django_filters.views import FilterView
from sapl.base.models import AppConfig as AppsAppConfig from sapl.base.models import AppConfig as AppsAppConfig
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud, MasterDetailCrud,

1
sapl/test_crispy_layout_mixin.py

@ -1,6 +1,7 @@
from unittest import mock from unittest import mock
import rtyaml import rtyaml
from sapl.crispy_layout_mixin import read_layout_from_yaml 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.apps import apps
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.management import _get_all_permissions from django.contrib.auth.management import _get_all_permissions
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import transaction from django.db import transaction
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _ 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.crud.base import PermissionRequiredForAppCrudMixin
from sapl.rules.apps import AppConfig, update_groups from sapl.rules.apps import AppConfig, update_groups
@ -14,7 +14,6 @@ from scripts.lista_urls import lista_urls
from .settings import SAPL_APPS from .settings import SAPL_APPS
pytestmark = pytest.mark.django_db pytestmark = pytest.mark.django_db
sapl_appconfs = [apps.get_app_config(n[5:]) for n in SAPL_APPS] 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 1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(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.api.urls
import sapl.base.urls import sapl.base.urls
import sapl.comissoes.urls import sapl.comissoes.urls
@ -26,12 +33,6 @@ import sapl.protocoloadm.urls
import sapl.redireciona_urls.urls import sapl.redireciona_urls.urls
import sapl.relatorios.urls import sapl.relatorios.urls
import sapl.sessao.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 = [ urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'), url(r'^$', TemplateView.as_view(template_name='index.html'),

13
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 hashlib
import logging import logging
import os import os
import re 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.helper import FormHelper
from crispy_forms.layout import HTML, Button from crispy_forms.layout import HTML, Button
from django import forms from django import forms
@ -23,13 +25,10 @@ from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput from floppyforms import ClearableFileInput
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
from unipath.path import Path from unipath.path import Path
import django_filters
import magic
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.settings import BASE_DIR from sapl.settings import BASE_DIR
sapl_logger = logging.getLogger(BASE_DIR.name) sapl_logger = logging.getLogger(BASE_DIR.name)
@ -49,7 +48,7 @@ def clear_thumbnails_cache(queryset, field):
path = Path(getattr(r, field).path) path = Path(getattr(r, field).path)
if not path.exists(): if not path.exists():
continue continue
cache_files = path.parent.walk() cache_files = path.parent.walk()

1
scripts/anonimizador/anon.py

@ -5,6 +5,7 @@ from string import digits
from django.apps import apps from django.apps import apps
from django.db.models.fields import CharField, TextField from django.db.models.fields import CharField, TextField
from sapl.materia.models import Orgao, Origem from sapl.materia.models import Orgao, Origem
from sapl.norma.models import AssuntoNorma from sapl.norma.models import AssuntoNorma
from sapl.parlamentares.models import Municipio, NivelInstrucao, Partido 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.apps import apps
from django.db import models from django.db import models
from sapl.settings import SAPL_APPS from sapl.settings import SAPL_APPS

1
scripts/fk_protocoloadm_docadm.py

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

Loading…
Cancel
Save