Browse Source

Corrige PEP 8

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

1
create_admin.py

@ -35,6 +35,7 @@ def create_superuser():
sys.exit(0) sys.exit(0)
if __name__ == '__main__': if __name__ == '__main__':
django.setup() django.setup()
create_superuser() create_superuser()

1
genkey.py

@ -6,5 +6,6 @@ def generate_secret():
'abcdefghijklmnopqrst' 'abcdefghijklmnopqrst'
'uvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])) 'uvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]))
if __name__ == '__main__': if __name__ == '__main__':
print(generate_secret()) print(generate_secret())

1
sapl/api/forms.py

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

2
sapl/base/admin.py

@ -3,7 +3,6 @@ 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
@ -41,4 +40,5 @@ class RevisionAdmin(admin.ModelAdmin):
self.message_user(request, _('You cannot change history.')) self.message_user(request, _('You cannot change history.'))
return redirect('admin:reversion_revision_changelist') return redirect('admin:reversion_revision_changelist')
admin.site.register(Revision, RevisionAdmin) admin.site.register(Revision, RevisionAdmin)

10
sapl/base/forms.py

@ -1,3 +1,4 @@
import django_filters
from crispy_forms.bootstrap import FieldWithButtons, InlineRadios, StrictButton from crispy_forms.bootstrap import FieldWithButtons, InlineRadios, StrictButton
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button, Div, Field, Fieldset, Layout, Row from crispy_forms.layout import HTML, Button, Div, Field, Fieldset, Layout, Row
@ -9,12 +10,9 @@ from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm,
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models, transaction from django.db import models, transaction
from django.forms import ModelForm, Form from django.forms import Form, ModelForm
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
import django_filters
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)
@ -28,7 +26,6 @@ from sapl.utils import (RANGE_ANOS, ChoiceWithoutValidationField,
from .models import AppConfig, CasaLegislativa from .models import AppConfig, CasaLegislativa
ACTION_CREATE_USERS_AUTOR_CHOICE = [ ACTION_CREATE_USERS_AUTOR_CHOICE = [
('A', _('Associar um usuário existente')), ('A', _('Associar um usuário existente')),
('N', _('Autor sem Usuário de Acesso ao Sapl')), ('N', _('Autor sem Usuário de Acesso ao Sapl')),
@ -728,7 +725,6 @@ class AlterarSenhaForm(Form):
max_length=50, max_length=50,
widget=forms.PasswordInput()) widget=forms.PasswordInput())
class Meta: class Meta:
fields = ['username', 'old_password', 'new_password1', 'new_password2'] fields = ['username', 'old_password', 'new_password1', 'new_password2']

1
sapl/base/models.py

@ -5,7 +5,6 @@ from django.db import models
from django.db.models.signals import post_migrate from django.db.models.signals import post_migrate
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 sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES, from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES,
get_settings_auth_user_model, models_with_gr_for_model) get_settings_auth_user_model, models_with_gr_for_model)

13
sapl/base/search_indexes.py

@ -3,7 +3,8 @@ import os.path
import re import re
import string import string
from django.db.models import Q, F, Value import textract
from django.db.models import F, Q, Value
from django.db.models.fields import TextField from django.db.models.fields import TextField
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from django.db.models.functions import Concat from django.db.models.functions import Concat
@ -12,15 +13,13 @@ 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,
import textract STATUS_TA_PUBLIC, Dispositivo,
TextoArticulado)
from sapl.compilacao.models import TextoArticulado, Dispositivo,\
STATUS_TA_PUBLIC, STATUS_TA_IMMUTABLE_PUBLIC
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)

2
sapl/base/templatetags/base_tags.py

@ -6,4 +6,4 @@ register = template.Library()
@register.filter @register.filter
def tipoautor_contenttype_list(tipo): def tipoautor_contenttype_list(tipo):
return 'sapl.'+tipo.content_type.app_label+':'+tipo.content_type.model+'_list' return 'sapl.' + tipo.content_type.app_label + ':' + tipo.content_type.model + '_list'

1
sapl/base/templatetags/common_tags.py

@ -1,6 +1,5 @@
from compressor.utils import get_class from compressor.utils import get_class
from django import template from django import template
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

2
sapl/base/templatetags/menus.py

@ -1,8 +1,8 @@
import yaml 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 _
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,6 +1,5 @@
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,6 +1,5 @@
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('',

8
sapl/base/urls.py

@ -5,18 +5,18 @@ 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 (AppConfigCrud, CasaLegislativaCrud, HelpTopicView, from .views import (AlterarSenha, AppConfigCrud, CasaLegislativaCrud,
RelatorioAtasView, RelatorioHistoricoTramitacaoView, HelpTopicView, RelatorioAtasView,
RelatorioHistoricoTramitacaoView,
RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAnoAutorTipoView,
RelatorioMateriasPorAutorView, RelatorioMateriasPorAutorView,
RelatorioMateriasTramitacaoView, RelatorioMateriasTramitacaoView,
RelatorioPresencaSessaoView, SaplSearchView, AlterarSenha) RelatorioPresencaSessaoView, SaplSearchView)
app_name = AppConfig.name app_name = AppConfig.name

14
sapl/base/views.py

@ -1,5 +1,5 @@
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.contrib.auth.tokens import default_token_generator from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
@ -11,12 +11,12 @@ from django.template import TemplateDoesNotExist
from django.template.loader import get_template from django.template.loader import get_template
from django.utils.encoding import force_bytes 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 _, string_concat from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.views.generic import FormView
from django.views.generic.base import TemplateView from django.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 django.views.generic import FormView
from django.contrib.auth import update_session_auth_hash
from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm from sapl.base.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 from sapl.crud.base import CrudAux
@ -27,13 +27,13 @@ from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria,
from sapl.utils import (parlamentares_ativos, sapl_logger, from sapl.utils import (parlamentares_ativos, sapl_logger,
show_results_filter_set) show_results_filter_set)
from .forms import (CasaLegislativaForm, ConfiguracoesAppForm, from .forms import (AlterarSenhaForm, CasaLegislativaForm,
RelatorioAtasFilterSet, ConfiguracoesAppForm, RelatorioAtasFilterSet,
RelatorioHistoricoTramitacaoFilterSet, RelatorioHistoricoTramitacaoFilterSet,
RelatorioMateriasPorAnoAutorTipoFilterSet, RelatorioMateriasPorAnoAutorTipoFilterSet,
RelatorioMateriasPorAutorFilterSet, RelatorioMateriasPorAutorFilterSet,
RelatorioMateriasTramitacaoilterSet, RelatorioMateriasTramitacaoilterSet,
RelatorioPresencaSessaoFilterSet, AlterarSenhaForm) RelatorioPresencaSessaoFilterSet)
from .models import AppConfig, CasaLegislativa from .models import AppConfig, CasaLegislativa

33
sapl/comissoes/forms.py

@ -1,17 +1,17 @@
from django.db.models import Q
from django import forms from django import forms
from django.core.exceptions import ValidationError
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import transaction from django.db import transaction
from django.db.models import Q
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 Participacao, Composicao, Comissao from sapl.comissoes.models import Comissao, Composicao, Participacao
from sapl.parlamentares.models import Parlamentar, Legislatura, Mandato from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar
class ParticipacaoCreateForm(forms.ModelForm): class ParticipacaoCreateForm(forms.ModelForm):
parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput()) parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
class Meta: class Meta:
model = Participacao model = Participacao
@ -34,14 +34,14 @@ class ParticipacaoCreateForm(forms.ModelForm):
parlamentares = Mandato.objects.filter(qs, parlamentares = Mandato.objects.filter(qs,
parlamentar__ativo=True parlamentar__ativo=True
).prefetch_related('parlamentar').\ ).prefetch_related('parlamentar').\
values_list('parlamentar', values_list('parlamentar',
flat=True).distinct() flat=True).distinct()
qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\ qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\
exclude(id__in=id_part) exclude(id__in=id_part)
eligible = self.verifica() eligible = self.verifica()
result = list(set(qs) & set(eligible)) result = list(set(qs) & set(eligible))
if not cmp(result, eligible): # se igual a 0 significa que o qs e o eli são iguais! if not cmp(result, eligible): # se igual a 0 significa que o qs e o eli são iguais!
self.fields['parlamentar'].queryset = qs self.fields['parlamentar'].queryset = qs
else: else:
ids = [e.id for e in eligible] ids = [e.id for e in eligible]
@ -55,7 +55,7 @@ class ParticipacaoCreateForm(forms.ModelForm):
q1 = Q(data_fim_mandato__isnull=False, q1 = Q(data_fim_mandato__isnull=False,
data_fim_mandato__gte=data_inicio_comissao) data_fim_mandato__gte=data_inicio_comissao)
q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \ q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \
& Q(data_inicio_mandato__lte=data_fim_comissao) & Q(data_inicio_mandato__lte=data_fim_comissao)
q3 = Q(data_fim_mandato__isnull=True, q3 = Q(data_fim_mandato__isnull=True,
data_inicio_mandato__lte=data_inicio_comissao) data_inicio_mandato__lte=data_inicio_comissao)
qs = q1 | q2 | q3 qs = q1 | q2 | q3
@ -82,17 +82,18 @@ class ParticipacaoCreateForm(forms.ModelForm):
comp_data_inicio = composicao.periodo.data_inicio comp_data_inicio = composicao.periodo.data_inicio
comp_data_fim = composicao.periodo.data_fim comp_data_fim = composicao.periodo.data_fim
if (data_fim and data_fim >= comp_data_inicio)\ if (data_fim and data_fim >= comp_data_inicio)\
or (data_inicio >= comp_data_inicio and data_inicio <= comp_data_fim)\ or (data_inicio >= comp_data_inicio and data_inicio <= comp_data_fim)\
or (data_fim is None and data_inicio <= comp_data_inicio): or (data_fim is None and data_inicio <= comp_data_inicio):
lista.append(p) lista.append(p)
lista = list(set(lista)) lista = list(set(lista))
return lista return lista
class ParticipacaoEditForm(forms.ModelForm): class ParticipacaoEditForm(forms.ModelForm):
parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput()) parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput())
nome_parlamentar = forms.CharField(required=False, label='Parlamentar') nome_parlamentar = forms.CharField(required=False, label='Parlamentar')
class Meta: class Meta:
@ -111,8 +112,6 @@ class ParticipacaoEditForm(forms.ModelForm):
self.fields['nome_parlamentar'].widget.attrs['disabled'] = 'disabled' self.fields['nome_parlamentar'].widget.attrs['disabled'] = 'disabled'
class ComissaoForm(forms.ModelForm): class ComissaoForm(forms.ModelForm):
class Meta: class Meta:
@ -135,7 +134,7 @@ class ComissaoForm(forms.ModelForm):
content_type = ContentType.objects.get_for_model(Comissao) content_type = ContentType.objects.get_for_model(Comissao)
object_id = comissao.pk object_id = comissao.pk
tipo = TipoAutor.objects.get(descricao__icontains='Comiss') tipo = TipoAutor.objects.get(descricao__icontains='Comiss')
nome = comissao.sigla+' - '+comissao.nome nome = comissao.sigla + ' - ' + comissao.nome
Autor.objects.create( Autor.objects.create(
content_type=content_type, content_type=content_type,
object_id=object_id, object_id=object_id,

1
sapl/comissoes/models.py

@ -3,7 +3,6 @@ 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.parlamentares.models import Parlamentar from sapl.parlamentares.models import Parlamentar
from sapl.utils import YES_NO_CHOICES, SaplGenericRelation from sapl.utils import YES_NO_CHOICES, SaplGenericRelation

1
sapl/comissoes/tests/test_comissoes.py

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

1
sapl/comissoes/urls.py

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

4
sapl/comissoes/views.py

@ -3,7 +3,6 @@ from django.core.urlresolvers import reverse
from django.db.models import F from django.db.models import F
from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import ListView from django.views.generic import ListView
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 from sapl.crud.base import RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud
from sapl.materia.models import MateriaLegislativa, Tramitacao from sapl.materia.models import MateriaLegislativa, Tramitacao
@ -19,6 +18,7 @@ def pegar_url_composicao(pk):
url = reverse('sapl.comissoes:composicao_detail', kwargs={'pk': comp_pk}) url = reverse('sapl.comissoes:composicao_detail', kwargs={'pk': comp_pk})
return url return url
CargoCrud = CrudAux.build(CargoComissao, 'cargo_comissao') CargoCrud = CrudAux.build(CargoComissao, 'cargo_comissao')
PeriodoComposicaoCrud = CrudAux.build(Periodo, 'periodo_composicao_comissao') PeriodoComposicaoCrud = CrudAux.build(Periodo, 'periodo_composicao_comissao')
@ -58,7 +58,6 @@ class ParticipacaoCrud(MasterDetailCrud):
) )
class ComposicaoCrud(MasterDetailCrud): class ComposicaoCrud(MasterDetailCrud):
model = Composicao model = Composicao
parent_field = 'comissao' parent_field = 'comissao'
@ -111,6 +110,7 @@ class ComissaoCrud(Crud):
def form_valid(self, form): def form_valid(self, form):
return super(Crud.CreateView, self).form_valid(form) return super(Crud.CreateView, self).form_valid(form)
class MateriasTramitacaoListView(ListView): class MateriasTramitacaoListView(ListView):
template_name = "comissoes/materias_em_tramitacao.html" template_name = "comissoes/materias_em_tramitacao.html"
paginate_by = 10 paginate_by = 10

1
sapl/compilacao/forms.py

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

3
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,8 +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)
from sapl.utils import YES_NO_CHOICES, get_settings_auth_user_model from sapl.utils import YES_NO_CHOICES, get_settings_auth_user_model

1
sapl/compilacao/templatetags/compilacao_filters.py

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

1
sapl/compilacao/tests/test_tipo_texto_articulado_form.py

@ -1,7 +1,6 @@
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.compilacao import forms from sapl.compilacao import forms
from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota from sapl.compilacao.models import PerfilEstruturalTextoArticulado, TipoNota
from sapl.compilacao.views import choice_models_in_extenal_views from sapl.compilacao.views import choice_models_in_extenal_views

1
sapl/compilacao/urls.py

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

8
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,14 +19,13 @@ 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,
UpdateView) UpdateView)
from django.views.generic.list import ListView from django.views.generic.list import ListView
from sapl.compilacao.forms import (DispositivoDefinidorVigenciaForm, from sapl.compilacao.forms import (DispositivoDefinidorVigenciaForm,
DispositivoEdicaoAlteracaoForm, DispositivoEdicaoAlteracaoForm,
DispositivoEdicaoBasicaForm, DispositivoEdicaoBasicaForm,
@ -50,7 +49,6 @@ from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED,
from sapl.crud.base import Crud, CrudListView, make_pagination from sapl.crud.base import Crud, CrudListView, make_pagination
from sapl.settings import BASE_DIR from sapl.settings import BASE_DIR
TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota') TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota')
TipoVideCrud = Crud.build(TipoVide, 'tipo_vide') TipoVideCrud = Crud.build(TipoVide, 'tipo_vide')
TipoPublicacaoCrud = Crud.build(TipoPublicacao, 'tipo_publicacao') TipoPublicacaoCrud = Crud.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):

4
sapl/crud/base.py

@ -17,20 +17,18 @@ 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
from django.views.generic.list import MultipleObjectMixin from django.views.generic.list import MultipleObjectMixin
from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display
from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL, from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL,
RP_LIST) RP_LIST)
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,7 +1,6 @@
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_25_31.py

@ -1,6 +1,5 @@
from django.core import management from django.core import management
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from sapl.legacy import migration from sapl.legacy import migration

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

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

2
sapl/legacy/migracao_documentos.py

@ -2,9 +2,9 @@ import mimetypes
import os import os
import re import re
import magic
import yaml import yaml
import magic
from sapl.base.models import CasaLegislativa from sapl.base.models import CasaLegislativa
from sapl.legacy.migration import exec_legado, warn from sapl.legacy.migration import exec_legado, warn
from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa, from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa,

1
sapl/legacy/migracao_usuarios.py

@ -1,5 +1,4 @@
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from sapl.settings import MEDIA_ROOT from sapl.settings import MEDIA_ROOT
PERFIL_LEGADO_PARA_NOVO = {legado: Group.objects.get(name=novo) PERFIL_LEGADO_PARA_NOVO = {legado: Group.objects.get(name=novo)

5
sapl/legacy/migration.py

@ -5,8 +5,9 @@ from itertools import groupby
from subprocess import PIPE, call from subprocess import PIPE, call
import pkg_resources import pkg_resources
import reversion
import yaml import yaml
import reversion
from django.apps import apps from django.apps import apps
from django.apps.config import AppConfig from django.apps.config import AppConfig
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
@ -16,7 +17,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.db import connections, transaction from django.db import connections, transaction
from django.db.models import Count, Max from django.db.models import Count, Max
from django.db.models.base import ModelBase from django.db.models.base import ModelBase
from sapl.base.models import AppConfig as AppConf from sapl.base.models import AppConfig as AppConf
from sapl.base.models import (Autor, ProblemaMigracao, TipoAutor, from sapl.base.models import (Autor, ProblemaMigracao, TipoAutor,
cria_models_tipo_autor) cria_models_tipo_autor)
@ -145,6 +145,7 @@ def exec_sql(sql, db='default'):
cursor.execute(sql) cursor.execute(sql)
return cursor return cursor
exec_legado = partial(exec_sql, db='legacy') exec_legado = partial(exec_sql, db='legacy')

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

@ -12,6 +12,7 @@ from functools import partial
from os.path import splitext from os.path import splitext
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.migration import appconfs, get_renames from sapl.legacy.migration 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,5 +1,4 @@
from django.apps import apps from django.apps import apps
from sapl.legacy.migration import legacy_app from sapl.legacy.migration import legacy_app
for model in apps.get_app_config('legacy').get_models(): for model in apps.get_app_config('legacy').get_models():

1
sapl/lexml/urls.py

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

1
sapl/materia/admin.py

@ -1,5 +1,4 @@
from django.contrib import admin from django.contrib import admin
from sapl.materia.models import Proposicao from sapl.materia.models import Proposicao
from sapl.settings import DEBUG from sapl.settings import DEBUG
from sapl.utils import register_all_models_in_admin from sapl.utils import register_all_models_in_admin

1
sapl/materia/email_utils.py

@ -4,7 +4,6 @@ from django.core.mail import EmailMultiAlternatives, get_connection, send_mail
from django.core.urlresolvers import reverse from django.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

12
sapl/materia/forms.py

@ -1,6 +1,8 @@
import os import os
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,
@ -21,8 +23,6 @@ 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 _
import django_filters
from sapl.base.models import Autor, TipoAutor from sapl.base.models import 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,
@ -30,8 +30,8 @@ from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
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 (AssuntoMateria, MateriaAssunto, from sapl.materia.models import (AssuntoMateria, MateriaAssunto,
MateriaLegislativa, RegimeTramitacao, MateriaLegislativa, Orgao, RegimeTramitacao,
TipoDocumento, TipoProposicao, Orgao) TipoDocumento, TipoProposicao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica, from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica) TipoNormaJuridica)
from sapl.protocoloadm.models import Protocolo from sapl.protocoloadm.models import Protocolo
@ -41,7 +41,6 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
MateriaPesquisaOrderingFilter, RangeWidgetOverride, MateriaPesquisaOrderingFilter, RangeWidgetOverride,
autor_label, autor_modal, models_with_gr_for_model, autor_label, autor_modal, models_with_gr_for_model,
qs_override_django_filter) qs_override_django_filter)
import sapl
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, Numeracao, Proposicao, Relatoria, DocumentoAcessorio, Numeracao, Proposicao, Relatoria,
@ -90,7 +89,7 @@ class OrgaoForm(ModelForm):
content_type = ContentType.objects.get_for_model(Orgao) content_type = ContentType.objects.get_for_model(Orgao)
object_id = orgao.pk object_id = orgao.pk
tipo = TipoAutor.objects.get(descricao='Órgão') tipo = TipoAutor.objects.get(descricao='Órgão')
nome = orgao.nome+' - '+orgao.sigla nome = orgao.nome + ' - ' + orgao.sigla
Autor.objects.create( Autor.objects.create(
content_type=content_type, content_type=content_type,
object_id=object_id, object_id=object_id,
@ -99,6 +98,7 @@ class OrgaoForm(ModelForm):
) )
return orgao return orgao
class ReceberProposicaoForm(Form): class ReceberProposicaoForm(Form):
cod_hash = forms.CharField(label='Código do Documento', required=True) cod_hash = forms.CharField(label='Código do Documento', required=True)

10
sapl/materia/models.py

@ -9,7 +9,6 @@ from django.db.models.functions import Concat
from django.utils import formats, timezone 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 from sapl.base.models import 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,
@ -799,12 +798,13 @@ class UnidadeTramitacaoManager(models.Manager):
Esta classe permite ordenar alfabeticamente a unidade de tramitacao Esta classe permite ordenar alfabeticamente a unidade de tramitacao
através da concatenação de 3 fields através da concatenação de 3 fields
""" """
def get_queryset(self): def get_queryset(self):
return super(UnidadeTramitacaoManager, self).get_queryset().annotate( return super(UnidadeTramitacaoManager, self).get_queryset().annotate(
nome_composto=Concat('orgao__nome', nome_composto=Concat('orgao__nome',
'comissao__sigla', 'comissao__sigla',
'parlamentar__nome_parlamentar') 'parlamentar__nome_parlamentar')
).order_by('nome_composto') ).order_by('nome_composto')
@reversion.register() @reversion.register()

1
sapl/materia/receivers.py

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

3
sapl/materia/tests/test_materia.py

@ -1,10 +1,9 @@
import pytest
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 model_mommy import mommy from model_mommy import mommy
import pytest
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
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,

1
sapl/materia/tests/test_materia_form.py

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

4
sapl/materia/urls.py

@ -1,5 +1,4 @@
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,
@ -24,8 +23,7 @@ from sapl.materia.views import (AcompanhamentoConfirmarView,
TipoProposicaoCrud, TramitacaoCrud, TipoProposicaoCrud, TramitacaoCrud,
TramitacaoEmLoteView, UnidadeTramitacaoCrud, TramitacaoEmLoteView, UnidadeTramitacaoCrud,
proposicao_texto, recuperar_materia) proposicao_texto, recuperar_materia)
from sapl.norma.views import NormaPesquisaSimplesView
from sapl.norma.views import NormaPesquisaSimplesView
from .apps import AppConfig from .apps import AppConfig

30
sapl/materia/views.py

@ -2,6 +2,8 @@ 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 sapl
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
@ -21,8 +23,6 @@ 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
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,
@ -35,28 +35,28 @@ from sapl.crud.base import (ACTION_CREATE, ACTION_DELETE, ACTION_DETAIL,
PermissionRequiredForAppCrudMixin, make_pagination) PermissionRequiredForAppCrudMixin, make_pagination)
from sapl.materia.forms import (AnexadaForm, AutoriaForm, from sapl.materia.forms import (AnexadaForm, AutoriaForm,
AutoriaMultiCreateForm, AutoriaMultiCreateForm,
ConfirmarProposicaoForm, LegislacaoCitadaForm, ConfirmarProposicaoForm,
ProposicaoForm, TipoProposicaoForm, DevolverProposicaoForm, LegislacaoCitadaForm,
TramitacaoForm, TramitacaoUpdateForm, OrgaoForm, ProposicaoForm, TipoProposicaoForm,
DevolverProposicaoForm, OrgaoForm) TramitacaoForm, TramitacaoUpdateForm)
from sapl.norma.models import LegislacaoCitada from sapl.norma.models import LegislacaoCitada
from sapl.protocoloadm.models import Protocolo from sapl.protocoloadm.models import Protocolo
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, 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,
montar_row_autor, show_results_filter_set, get_mime_type_from_file_extension) get_mime_type_from_file_extension, montar_row_autor,
import sapl show_results_filter_set)
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,
AdicionarVariasAutoriasFilterSet, DespachoInicialForm, AdicionarVariasAutoriasFilterSet, DespachoInicialForm,
DocumentoAcessorioForm, EtiquetaPesquisaForm, DocumentoAcessorioForm, EtiquetaPesquisaForm,
FichaPesquisaForm, FichaSelecionaForm, MateriaAssuntoForm, FichaPesquisaForm, FichaSelecionaForm, MateriaAssuntoForm,
MateriaLegislativaFilterSet, MateriaSimplificadaForm, MateriaLegislativaFilterSet, MateriaLegislativaForm,
PrimeiraTramitacaoEmLoteFilterSet, ReceberProposicaoForm, MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet,
RelatoriaForm, TramitacaoEmLoteFilterSet, ReceberProposicaoForm, RelatoriaForm,
filtra_tramitacao_destino, TramitacaoEmLoteFilterSet, filtra_tramitacao_destino,
filtra_tramitacao_destino_and_status, filtra_tramitacao_destino_and_status,
filtra_tramitacao_status, MateriaLegislativaForm) filtra_tramitacao_status)
from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria,
DespachoInicial, DocumentoAcessorio, MateriaAssunto, DespachoInicial, DocumentoAcessorio, MateriaAssunto,
MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao, MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao,
@ -65,7 +65,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 = Crud.build(AssuntoMateria, 'assunto_materia') AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia')
OrigemCrud = Crud.build(Origem, '') OrigemCrud = Crud.build(Origem, '')
@ -296,14 +295,17 @@ def recuperar_materia(request):
return response return response
StatusTramitacaoCrud = CrudAux.build(StatusTramitacao, 'status_tramitacao') StatusTramitacaoCrud = CrudAux.build(StatusTramitacao, 'status_tramitacao')
class OrgaoCrud(Crud): class OrgaoCrud(Crud):
model = Orgao model = Orgao
class CreateView(Crud.CreateView): class CreateView(Crud.CreateView):
form_class = OrgaoForm form_class = OrgaoForm
class TipoProposicaoCrud(CrudAux): class TipoProposicaoCrud(CrudAux):
model = TipoProposicao model = TipoProposicao
help_text = 'tipo_proposicao' help_text = 'tipo_proposicao'

20
sapl/norma/forms.py

@ -8,7 +8,6 @@ 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
@ -216,6 +215,7 @@ class NormaRelacionadaForm(ModelForm):
relacionada.save() relacionada.save()
return relacionada return relacionada
class NormaPesquisaSimplesForm(forms.Form): class NormaPesquisaSimplesForm(forms.Form):
tipo_norma = forms.ModelChoiceField( tipo_norma = forms.ModelChoiceField(
label=TipoNormaJuridica._meta.verbose_name, label=TipoNormaJuridica._meta.verbose_name,
@ -268,16 +268,14 @@ class NormaPesquisaSimplesForm(forms.Form):
data_final = cleaned_data['data_final'] data_final = cleaned_data['data_final']
if (data_inicial and data_final and if (data_inicial and data_final and
data_inicial > data_final): data_inicial > data_final):
raise ValidationError(_( raise ValidationError(_(
'A Data Final não pode ser menor que a Data Inicial')) 'A Data Final não pode ser menor que a Data Inicial'))
else: else:
condicao1 = data_inicial and not data_final condicao1 = data_inicial and not data_final
condicao2 = not data_inicial and data_final condicao2 = not data_inicial and data_final
if condicao1 or condicao2: if condicao1 or condicao2:
raise ValidationError(_('Caso pesquise por data, os campos de Data Inicial e ' + raise ValidationError(_('Caso pesquise por data, os campos de Data Inicial e ' +
'Data Final devem ser preenchidos obrigatoriamente')) 'Data Final devem ser preenchidos obrigatoriamente'))
return cleaned_data return cleaned_data

1
sapl/norma/models.py

@ -4,7 +4,6 @@ from django.db import models
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 model_utils import Choices from model_utils import Choices
from sapl.compilacao.models import TextoArticulado from sapl.compilacao.models import TextoArticulado
from sapl.materia.models import MateriaLegislativa from sapl.materia.models import MateriaLegislativa
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,

10
sapl/norma/tests/test_norma.py

@ -2,9 +2,9 @@ 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, NormaRelacionadaForm, NormaPesquisaSimplesForm from sapl.norma.forms import (NormaJuridicaForm, NormaPesquisaSimplesForm,
NormaRelacionadaForm)
from sapl.norma.models import NormaJuridica, TipoNormaJuridica from sapl.norma.models import NormaJuridica, TipoNormaJuridica
@ -137,9 +137,9 @@ def test_norma_pesquisa_form_datas_invalidas():
tipo = mommy.make(TipoNormaJuridica) tipo = mommy.make(TipoNormaJuridica)
form = NormaPesquisaSimplesForm(data={'tipo_norma': str(tipo.pk), form = NormaPesquisaSimplesForm(data={'tipo_norma': str(tipo.pk),
'data_inicial': '10/11/2017', 'data_inicial': '10/11/2017',
'data_final': '09/11/2017' 'data_final': '09/11/2017'
}) })
assert not form.is_valid() assert not form.is_valid()
assert form.errors['__all__'] == [_('A Data Final não pode ser menor que ' assert form.errors['__all__'] == [_('A Data Final não pode ser menor que '
'a Data Inicial')] 'a Data Inicial')]

1
sapl/norma/urls.py

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

22
sapl/norma/views.py

@ -1,26 +1,24 @@
import weasyprint
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import JsonResponse from django.http import HttpResponse, JsonResponse
from django.template import RequestContext, loader
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django_filters.views import FilterView
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.http import HttpResponse, JsonResponse
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from django.views.generic import CreateView, ListView, TemplateView, UpdateView from django_filters.views import FilterView
from django.template import RequestContext, loader
import weasyprint
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,
MasterDetailCrud, make_pagination) MasterDetailCrud, make_pagination)
from sapl.utils import show_results_filter_set from sapl.utils import show_results_filter_set
from .forms import NormaFilterSet, NormaJuridicaForm, NormaRelacionadaForm, NormaPesquisaSimplesForm from .forms import (NormaFilterSet, NormaJuridicaForm,
NormaPesquisaSimplesForm, NormaRelacionadaForm)
from .models import (AssuntoNorma, NormaJuridica, NormaRelacionada, from .models import (AssuntoNorma, NormaJuridica, NormaRelacionada,
TipoNormaJuridica, TipoVinculoNormaJuridica) TipoNormaJuridica, TipoVinculoNormaJuridica)
@ -243,13 +241,12 @@ def gerar_pdf_impressos(request, context, template_name):
return response return response
class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView): class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView):
form_class = NormaPesquisaSimplesForm form_class = NormaPesquisaSimplesForm
template_name = 'materia/impressos/norma.html' template_name = 'materia/impressos/norma.html'
permission_required = ('materia.can_access_impressos', ) permission_required = ('materia.can_access_impressos', )
def form_valid(self, form): def form_valid(self, form):
normas = NormaJuridica.objects.all().order_by( normas = NormaJuridica.objects.all().order_by(
'numero') 'numero')
@ -257,7 +254,6 @@ class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView):
titulo = form.cleaned_data['titulo'] titulo = form.cleaned_data['titulo']
if form.cleaned_data['tipo_norma']: if form.cleaned_data['tipo_norma']:
normas = normas.filter(tipo=form.cleaned_data['tipo_norma']) normas = normas.filter(tipo=form.cleaned_data['tipo_norma'])

18
sapl/painel/views.py

@ -11,16 +11,15 @@ 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
from sapl.painel.apps import AppConfig from sapl.painel.apps import AppConfig
from sapl.parlamentares.models import Legislatura, Parlamentar, Votante from sapl.parlamentares.models import Legislatura, Parlamentar, Votante
from sapl.sessao.models import (ExpedienteMateria, OrdemDia, OradorExpediente, from sapl.sessao.models import (ExpedienteMateria, OradorExpediente, OrdemDia,
PresencaOrdemDia, PresencaOrdemDia, RegistroVotacao,
RegistroVotacao, SessaoPlenaria, SessaoPlenaria, SessaoPlenariaPresenca,
SessaoPlenariaPresenca, VotoParlamentar) VotoParlamentar)
from sapl.utils import filiacao_data, get_client_ip, sort_lista_chave from sapl.utils import filiacao_data, get_client_ip, sort_lista_chave
from .models import Cronometro from .models import Cronometro
@ -304,16 +303,16 @@ def get_presentes(pk, response, materia):
oradores_list.append( oradores_list.append(
{ {
'nome': o.parlamentar.nome_parlamentar, 'nome': o.parlamentar.nome_parlamentar,
'numero': o.numero_ordem 'numero': o.numero_ordem
}) })
presentes_list = [] presentes_list = []
for p in presentes: for p in presentes:
now_year = timezone.now().year now_year = timezone.now().year
# Recupera a legislatura vigente # Recupera a legislatura vigente
legislatura = Legislatura.objects.get(data_inicio__year__lte = now_year, legislatura = Legislatura.objects.get(data_inicio__year__lte=now_year,
data_fim__year__gte = now_year) data_fim__year__gte=now_year)
# Recupera os mandatos daquele parlamentar # Recupera os mandatos daquele parlamentar
mandatos = p.parlamentar.mandato_set.filter(legislatura=legislatura) mandatos = p.parlamentar.mandato_set.filter(legislatura=legislatura)
@ -403,7 +402,6 @@ def get_votos(response, materia):
expediente_id=materia.id).order_by( expediente_id=materia.id).order_by(
'parlamentar__nome_parlamentar') 'parlamentar__nome_parlamentar')
for i, p in enumerate(response['presentes']): for i, p in enumerate(response['presentes']):
try: try:
if votos_parlamentares.get(parlamentar_id=p['parlamentar_id']).voto: if votos_parlamentares.get(parlamentar_id=p['parlamentar_id']).voto:

13
sapl/parlamentares/forms.py

@ -13,12 +13,11 @@ 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 floppyforms.widgets import ClearableFileInput from floppyforms.widgets import ClearableFileInput
from image_cropping.widgets import ImageCropWidget, CropWidget from image_cropping.widgets import CropWidget, ImageCropWidget
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.rules import SAPL_GROUP_VOTANTE from sapl.rules import SAPL_GROUP_VOTANTE
from sapl.base.models import Autor, TipoAutor
from .models import (ComposicaoColigacao, Filiacao, Frente, Legislatura, from .models import (ComposicaoColigacao, Filiacao, Frente, Legislatura,
Mandato, Parlamentar, Votante) Mandato, Parlamentar, Votante)
@ -177,10 +176,10 @@ class ParlamentarCreateForm(ParlamentarForm):
object_id = parlamentar.pk object_id = parlamentar.pk
tipo = TipoAutor.objects.get(descricao='Parlamentar') tipo = TipoAutor.objects.get(descricao='Parlamentar')
Autor.objects.create( Autor.objects.create(
content_type = content_type, content_type=content_type,
object_id = object_id, object_id=object_id,
tipo = tipo, tipo=tipo,
nome = parlamentar.nome_parlamentar nome=parlamentar.nome_parlamentar
) )
return parlamentar return parlamentar

3
sapl/parlamentares/models.py

@ -1,11 +1,10 @@
import reversion
from django.db import models from django.db import models
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 image_cropping.fields import ImageCropField, ImageRatioField from image_cropping.fields import ImageCropField, ImageRatioField
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.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,7 +2,6 @@ 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,7 +2,6 @@ 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,5 +1,4 @@
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,

8
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
@ -16,7 +16,6 @@ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import FormView from django.views.generic import FormView
from django.views.generic.edit import UpdateView from django.views.generic.edit import UpdateView
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.comissoes.models import Participacao from sapl.comissoes.models import Participacao
from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux, from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux,
@ -26,14 +25,13 @@ from sapl.materia.models import Autoria, Proposicao, Relatoria
from sapl.parlamentares.apps import AppConfig from sapl.parlamentares.apps import AppConfig
from sapl.utils import parlamentares_ativos from sapl.utils import parlamentares_ativos
from .forms import (FiliacaoForm, LegislaturaForm, MandatoForm, from .forms import (FiliacaoForm, FrenteForm, LegislaturaForm, MandatoForm,
ParlamentarCreateForm, ParlamentarForm, VotanteForm, FrenteForm) ParlamentarCreateForm, ParlamentarForm, VotanteForm)
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
Dependente, Filiacao, Frente, Legislatura, Mandato, Dependente, Filiacao, Frente, Legislatura, Mandato,
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')

1
sapl/protocoloadm/forms.py

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

1
sapl/protocoloadm/models.py

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

8
sapl/protocoloadm/views.py

@ -1,4 +1,5 @@
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
@ -14,15 +15,16 @@ 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
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.parlamentares.models import Legislatura, Parlamentar from sapl.parlamentares.models import Legislatura, Parlamentar
from sapl.protocoloadm.models import Protocolo from sapl.protocoloadm.models import Protocolo
from sapl.utils import create_barcode, get_client_ip, show_results_filter_set, get_mime_type_from_file_extension from sapl.utils import (create_barcode, get_client_ip,
get_mime_type_from_file_extension,
show_results_filter_set)
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
DocumentoAdministrativoFilterSet, DocumentoAdministrativoFilterSet,
DocumentoAdministrativoForm, ProtocoloDocumentForm, DocumentoAdministrativoForm, ProtocoloDocumentForm,

1
sapl/redireciona_urls/views.py

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

1
sapl/relatorios/views.py

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

1
sapl/rules/apps.py

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

2
sapl/rules/tests/test_rules.py

@ -5,7 +5,6 @@ from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.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,
@ -53,6 +52,7 @@ def test_models_in_rules_patterns(model_item):
str(model_item), str(model_item),
model_item._meta.verbose_name) model_item._meta.verbose_name)
# __falsos_positivos__ # __falsos_positivos__
__fp__in__test_permission_of_models_in_rules_patterns = { __fp__in__test_permission_of_models_in_rules_patterns = {
map_rules.RP_ADD: [CasaLegislativa, map_rules.RP_ADD: [CasaLegislativa,

8
sapl/sessao/forms.py

@ -9,7 +9,6 @@ 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
@ -20,8 +19,9 @@ from sapl.utils import (RANGE_DIAS_MES, RANGE_MESES,
MateriaPesquisaOrderingFilter, autor_label, MateriaPesquisaOrderingFilter, autor_label,
autor_modal, timezone) autor_modal, timezone)
from .models import (Bancada, ExpedienteMateria, Orador, OradorExpediente, from .models import (Bancada, Bloco, ExpedienteMateria, Orador,
OrdemDia, SessaoPlenaria, SessaoPlenariaPresenca, TipoResultadoVotacao, Bloco) OradorExpediente, OrdemDia, SessaoPlenaria,
SessaoPlenariaPresenca, TipoResultadoVotacao)
def recupera_anos(): def recupera_anos():
@ -129,6 +129,7 @@ class BancadaForm(ModelForm):
) )
return bancada return bancada
class BlocoForm(ModelForm): class BlocoForm(ModelForm):
class Meta: class Meta:
@ -160,6 +161,7 @@ class BlocoForm(ModelForm):
) )
return bloco return bloco
class ExpedienteMateriaForm(ModelForm): class ExpedienteMateriaForm(ModelForm):
_model = ExpedienteMateria _model = ExpedienteMateria

1
sapl/sessao/models.py

@ -2,7 +2,6 @@ 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 MateriaLegislativa from sapl.materia.models import MateriaLegislativa
from sapl.parlamentares.models import (CargoMesa, Legislatura, Parlamentar, from sapl.parlamentares.models import (CargoMesa, Legislatura, Parlamentar,

1
sapl/sessao/tests/test_sessao.py

@ -1,7 +1,6 @@
import pytest import pytest
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.parlamentares.models import Legislatura, Partido, SessaoLegislativa from sapl.parlamentares.models import Legislatura, Partido, SessaoLegislativa
from sapl.sessao import forms from sapl.sessao import forms

1
sapl/sessao/tests/test_sessao_view.py

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

4
sapl/sessao/urls.py

@ -1,5 +1,4 @@
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,
@ -18,9 +17,8 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente,
VotacaoNominalExpedienteDetailView, VotacaoNominalExpedienteDetailView,
VotacaoNominalExpedienteEditView, VotacaoNominalExpedienteEditView,
VotacaoNominalExpedienteView, VotacaoNominalExpedienteView,
VotacaoNominalView,
VotacaoNominalTransparenciaDetailView, VotacaoNominalTransparenciaDetailView,
VotacaoView, abrir_votacao, VotacaoNominalView, VotacaoView, abrir_votacao,
atualizar_mesa, insere_parlamentar_composicao, atualizar_mesa, insere_parlamentar_composicao,
mudar_ordem_materia_sessao, recuperar_materia, mudar_ordem_materia_sessao, recuperar_materia,
recuperar_numero_sessao, recuperar_numero_sessao,

36
sapl/sessao/views.py

@ -20,7 +20,6 @@ from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView from django.views.generic.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,
@ -36,12 +35,12 @@ from sapl.sessao.apps import AppConfig
from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm
from sapl.utils import show_results_filter_set from sapl.utils import show_results_filter_set
from .forms import (AdicionarVariasMateriasFilterSet, ExpedienteForm, from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm, BlocoForm,
ListMateriaForm, MesaForm, OradorExpedienteForm, ExpedienteForm, ListMateriaForm, MesaForm,
OradorForm, PautaSessaoFilterSet, PresencaForm, OradorExpedienteForm, OradorForm, PautaSessaoFilterSet,
ResumoOrdenacaoForm, SessaoPlenariaFilterSet, PresencaForm, ResumoOrdenacaoForm, SessaoPlenariaFilterSet,
SessaoPlenariaForm, VotacaoEditForm, VotacaoForm, SessaoPlenariaForm, VotacaoEditForm, VotacaoForm,
VotacaoNominalForm, BancadaForm, BlocoForm) VotacaoNominalForm)
from .models import (Bancada, Bloco, CargoBancada, CargoMesa, from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
ExpedienteMateria, ExpedienteSessao, IntegranteMesa, ExpedienteMateria, ExpedienteSessao, IntegranteMesa,
MateriaLegislativa, Orador, OradorExpediente, OrdemDia, MateriaLegislativa, Orador, OradorExpediente, OrdemDia,
@ -171,12 +170,12 @@ def customize_link_materia(context, pk):
turno__isnull=False, turno__isnull=False,
data_tramitacao__lte=data_inicio_sessao data_tramitacao__lte=data_inicio_sessao
).exclude(turno__exact='' ).exclude(turno__exact=''
).select_related( ).select_related(
'materia', 'materia',
'status', 'status',
'materia__tipo').order_by( 'materia__tipo').order_by(
'-data_tramitacao' '-data_tramitacao'
).first() ).first()
turno = ' ' turno = ' '
if tramitacao is not None: if tramitacao is not None:
for t in Tramitacao.TURNO_CHOICES: for t in Tramitacao.TURNO_CHOICES:
@ -355,7 +354,7 @@ class MateriaOrdemDiaCrud(MasterDetailCrud):
'pk': obj.sessao_plenaria_id, 'pk': obj.sessao_plenaria_id,
'oid': obj.pk, 'oid': obj.pk,
'mid': obj.materia_id}) +\ 'mid': obj.materia_id}) +\
'?&materia=ordem' '?&materia=ordem'
obj.resultado = ('<a href="%s">%s<br/>%s</a>' % obj.resultado = ('<a href="%s">%s<br/>%s</a>' %
(url, (url,
resultado_descricao, resultado_descricao,
@ -489,7 +488,7 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
'pk': obj.sessao_plenaria_id, 'pk': obj.sessao_plenaria_id,
'oid': obj.pk, 'oid': obj.pk,
'mid': obj.materia_id}) +\ 'mid': obj.materia_id}) +\
'?&materia=expediente' '?&materia=expediente'
obj.resultado = ('<a href="%s">%s<br/>%s</a>' % obj.resultado = ('<a href="%s">%s<br/>%s</a>' %
(url, (url,
resultado_descricao, resultado_descricao,
@ -572,6 +571,7 @@ class OradorCrud(OradorCrud):
return reverse('sapl.sessao:orador_list', return reverse('sapl.sessao:orador_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})
class BancadaCrud(Crud): class BancadaCrud(Crud):
model = Bancada model = Bancada
@ -581,6 +581,7 @@ class BancadaCrud(Crud):
def get_success_url(self): def get_success_url(self):
return reverse('sapl.sessao:bancada_list') return reverse('sapl.sessao:bancada_list')
class BlocoCrud(Crud): class BlocoCrud(Crud):
model = Bloco model = Bloco
@ -590,6 +591,7 @@ class BlocoCrud(Crud):
def get_success_url(self): def get_success_url(self):
return reverse('sapl.sessao:bloco_list') return reverse('sapl.sessao:bloco_list')
def recuperar_numero_sessao(request): def recuperar_numero_sessao(request):
try: try:
sessao = SessaoPlenaria.objects.filter( sessao = SessaoPlenaria.objects.filter(
@ -1793,7 +1795,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
except ObjectDoesNotExist: except ObjectDoesNotExist:
raise Http404() raise Http404()
if 'cancelar-votacao' in request.POST: if 'cancelar-votacao' in request.POST:
fechar_votacao_materia(materia_votacao) fechar_votacao_materia(materia_votacao)
return self.form_valid(form) return self.form_valid(form)
@ -1820,7 +1821,7 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
# Caso todas as opções sejam 'Não votou', fecha a votação # Caso todas as opções sejam 'Não votou', fecha a votação
if nao_votou == len(request.POST.getlist('voto_parlamentar')): if nao_votou == len(request.POST.getlist('voto_parlamentar')):
form.add_error(None, 'Não é possível finalizar a votação sem '\ form.add_error(None, 'Não é possível finalizar a votação sem '
'nenhum voto') 'nenhum voto')
return self.form_invalid(form) return self.form_invalid(form)
@ -1916,7 +1917,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
'oid': self.kwargs['oid'], 'oid': self.kwargs['oid'],
'mid': self.kwargs['mid']})) 'mid': self.kwargs['mid']}))
def get_parlamentares(self, presencas): def get_parlamentares(self, presencas):
self.object = self.get_object() self.object = self.get_object()
@ -2121,7 +2121,6 @@ class VotacaoNominalTransparenciaDetailView(TemplateView):
yield tipo yield tipo
class VotacaoNominalExpedienteDetailView(DetailView): class VotacaoNominalExpedienteDetailView(DetailView):
template_name = 'sessao/votacao/nominal_detail.html' template_name = 'sessao/votacao/nominal_detail.html'
@ -2523,7 +2522,6 @@ class PautaSessaoDetailView(DetailView):
return self.render_to_response(context) return self.render_to_response(context)
class PesquisarSessaoPlenariaView(FilterView): class PesquisarSessaoPlenariaView(FilterView):
model = SessaoPlenaria model = SessaoPlenaria
filterset_class = SessaoPlenariaFilterSet filterset_class = SessaoPlenariaFilterSet

1
sapl/settings.py

@ -23,7 +23,6 @@ from unipath import Path
from .temp_suppress_crispy_form_warnings import \ from .temp_suppress_crispy_form_warnings import \
SUPRESS_CRISPY_FORM_WARNINGS_LOGGING SUPRESS_CRISPY_FORM_WARNINGS_LOGGING
BASE_DIR = Path(__file__).ancestor(1) BASE_DIR = Path(__file__).ancestor(1)
PROJECT_DIR = Path(__file__).ancestor(2) PROJECT_DIR = Path(__file__).ancestor(2)

1
sapl/test_crispy_layout_mixin.py

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

6
sapl/test_urls.py

@ -1,20 +1,18 @@
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
from scripts.lista_urls import lista_urls 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,13 +13,6 @@ 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
@ -33,6 +26,12 @@ 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'),

2
sapl/utils.py

@ -23,7 +23,6 @@ from django.utils.translation import ugettext_lazy as _
from django_filters.filterset import STRICTNESS from django_filters.filterset import STRICTNESS
from floppyforms import ClearableFileInput from floppyforms import ClearableFileInput
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
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
@ -272,6 +271,7 @@ def listify(function):
return list(function(*args, **kwargs)) return list(function(*args, **kwargs))
return f return f
LISTA_DE_UFS = [ LISTA_DE_UFS = [
('AC', 'Acre'), ('AC', 'Acre'),
('AL', 'Alagoas'), ('AL', 'Alagoas'),

1
scripts/anonimizador/anon.py

@ -5,7 +5,6 @@ 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/atualizar_requirements.py

@ -33,6 +33,7 @@ def novas_linhas(linhas):
nome = nome.lower() nome = nome.lower()
yield '%s==%s' % (nome, freeze[nome]) yield '%s==%s' % (nome, freeze[nome])
for arq, linhas in requirements: for arq, linhas in requirements:
with open(arq, 'w') as f: with open(arq, 'w') as f:
f.writelines(l + '\n' for l in novas_linhas(linhas)) f.writelines(l + '\n' for l in novas_linhas(linhas))

1
scripts/convert_null_to_empty_in_all_char_fields.py

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

2
scripts/redbaron.py

@ -64,6 +64,8 @@ def frase(n):
def mark(n): def mark(n):
mark.ok |= {n.value} mark.ok |= {n.value}
mark.ok = set() mark.ok = set()

1
scripts/set_inicio_mandato.py

@ -6,5 +6,6 @@ def popula_campo_data_inicio():
m.data_inicio_mandato = m.legislatura.data_inicio m.data_inicio_mandato = m.legislatura.data_inicio
m.save() m.save()
if __name__ == '__main__': if __name__ == '__main__':
popula_campo_data_inicio() popula_campo_data_inicio()

Loading…
Cancel
Save