Browse Source

Primeira passada de check_qa.sh

pull/907/head
Edward Ribeiro 8 years ago
parent
commit
455fb37730
  1. 3
      sapl/api/views.py
  2. 5
      sapl/base/forms.py
  3. 9
      sapl/base/urls.py
  4. 1
      sapl/compilacao/forms.py
  5. 4
      sapl/compilacao/models.py
  6. 15
      sapl/compilacao/views.py
  7. 2
      sapl/crispy_layout_mixin.py
  8. 3
      sapl/crud/base.py
  9. 8
      sapl/legacy/migration.py
  10. 3
      sapl/legacy_migration_settings.py
  11. 4
      sapl/materia/forms.py
  12. 5
      sapl/materia/models.py
  13. 3
      sapl/materia/views.py
  14. 2
      sapl/norma/forms.py
  15. 12
      sapl/painel/views.py
  16. 2
      sapl/parlamentares/apps.py
  17. 3
      sapl/parlamentares/forms.py
  18. 1
      sapl/parlamentares/models.py
  19. 8
      sapl/parlamentares/views.py
  20. 4
      sapl/protocoloadm/views.py
  21. 4
      sapl/rules/apps.py
  22. 8
      sapl/rules/map_rules.py
  23. 4
      sapl/sessao/models.py
  24. 1
      sapl/settings.py
  25. 5
      sapl/test_urls.py
  26. 3
      sapl/urls.py
  27. 11
      sapl/utils.py

3
sapl/api/views.py

@ -5,7 +5,8 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework.filters import DjangoFilterBackend
from rest_framework.generics import ListAPIView
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.permissions import IsAuthenticated, IsAuthenticatedOrReadOnly
from rest_framework.permissions import (IsAuthenticated,
IsAuthenticatedOrReadOnly)
from rest_framework.viewsets import GenericViewSet
from sapl.api.forms import AutorChoiceFilterSet

5
sapl/base/forms.py

@ -1,3 +1,4 @@
import django_filters
from crispy_forms.bootstrap import FieldWithButtons, InlineRadios, StrictButton
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button, Div, Field, Fieldset, Layout, Row
@ -12,9 +13,8 @@ from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.forms import ModelForm
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
import django_filters
from django.utils.translation import string_concat
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column,
@ -28,7 +28,6 @@ from sapl.utils import (RANGE_ANOS, ChoiceWithoutValidationField,
from .models import AppConfig, CasaLegislativa
ACTION_CREATE_USERS_AUTOR_CHOICE = [
('C', _('Criar novo Usuário')),
('A', _('Associar um usuário existente')),

9
sapl/base/urls.py

@ -1,17 +1,16 @@
from django.conf.urls import include, url
from django.contrib.auth import views
from django.contrib.auth.views import (password_reset,
password_reset_done,
password_reset_confirm,
password_reset_complete)
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.views import (password_reset, password_reset_complete,
password_reset_confirm,
password_reset_done)
from django.views.generic.base import TemplateView
from sapl.base.views import AutorCrud, ConfirmarEmailView, TipoAutorCrud
from sapl.settings import EMAIL_SEND_USER
from .apps import AppConfig
from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm
from sapl.settings import EMAIL_SEND_USER
from .views import (AppConfigCrud, CasaLegislativaCrud, HelpView,
RelatorioAtasView, RelatorioHistoricoTramitacaoView,
RelatorioMateriasPorAnoAutorTipoView,

1
sapl/compilacao/forms.py

@ -25,7 +25,6 @@ from sapl.compilacao.utils import DISPOSITIVO_SELECT_RELATED
from sapl.crispy_layout_mixin import SaplFormLayout, to_column, to_row
from sapl.utils import YES_NO_CHOICES
error_messages = {
'required': _('Este campo é obrigatório'),
'invalid': _('URL inválida.')

4
sapl/compilacao/models.py

@ -12,8 +12,8 @@ from django.template import defaultfilters
from django.utils.decorators import classonlymethod
from django.utils.translation import ugettext_lazy as _
from sapl.compilacao.utils import int_to_letter, int_to_roman,\
get_integrations_view_names
from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter,
int_to_roman)
from sapl.utils import YES_NO_CHOICES, get_settings_auth_user_model

15
sapl/compilacao/views.py

@ -1,7 +1,7 @@
from collections import OrderedDict
from datetime import datetime, timedelta
import logging
import sys
from collections import OrderedDict
from datetime import datetime, timedelta
from braces.views import FormMessagesMixin
from django import forms
@ -10,7 +10,7 @@ from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.core.signing import Signer
from django.core.urlresolvers import reverse_lazy, reverse
from django.core.urlresolvers import reverse, reverse_lazy
from django.db import connection, transaction
from django.db.models import Q
from django.db.utils import IntegrityError
@ -19,8 +19,8 @@ from django.http.response import (HttpResponse, HttpResponseRedirect,
from django.shortcuts import get_object_or_404, redirect
from django.utils.dateparse import parse_date
from django.utils.encoding import force_text
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.edit import (CreateView, DeleteView, FormView,
@ -37,20 +37,19 @@ from sapl.compilacao.forms import (DispositivoDefinidorVigenciaForm,
DispositivoSearchModalForm, NotaForm,
PublicacaoForm, TaForm,
TextNotificacoesForm, TipoTaForm, VideForm)
from sapl.compilacao.models import (Dispositivo, Nota,
from sapl.compilacao.models import (STATUS_TA_EDITION, STATUS_TA_PRIVATE,
STATUS_TA_PUBLIC, Dispositivo, Nota,
PerfilEstruturalTextoArticulado,
Publicacao, TextoArticulado,
TipoDispositivo, TipoNota, TipoPublicacao,
TipoTextoArticulado, TipoVide,
VeiculoPublicacao, Vide, STATUS_TA_EDITION,
STATUS_TA_PRIVATE, STATUS_TA_PUBLIC)
VeiculoPublicacao, Vide)
from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED,
DISPOSITIVO_SELECT_RELATED_EDIT,
get_integrations_view_names)
from sapl.crud.base import Crud, CrudListView, make_pagination
from sapl.settings import BASE_DIR
TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota')
TipoVideCrud = Crud.build(TipoVide, 'tipo_vide')
TipoPublicacaoCrud = Crud.build(TipoPublicacao, 'tipo_publicacao')

2
sapl/crispy_layout_mixin.py

@ -1,12 +1,12 @@
from math import ceil
import rtyaml
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit
from django import template
from django.utils import formats
from django.utils.translation import ugettext as _
import rtyaml
def heads_and_tails(list_of_lists):

3
sapl/crud/base.py

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

8
sapl/legacy/migration.py

@ -1,24 +1,24 @@
import re
from datetime import date
import pkg_resources
import yaml
from datetime import date
from django.apps import apps
from django.apps.config import AppConfig
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.db import connections, models, OperationalError, ProgrammingError
from django.db.models import CharField, TextField, ProtectedError, Max
from django.db import OperationalError, ProgrammingError, connections, models
from django.db.models import CharField, Max, ProtectedError, TextField
from django.db.models.base import ModelBase
from model_mommy import mommy
from model_mommy.mommy import foreign_key_required, make
from sapl.base.models import Autor, ProblemaMigracao
from sapl.comissoes.models import Comissao, Composicao, Participacao
from sapl.legacy.models import Protocolo as ProtocoloLegado
from sapl.materia.models import (Proposicao, StatusTramitacao, TipoDocumento,
TipoMateriaLegislativa, TipoProposicao,
Tramitacao)
from sapl.legacy.models import Protocolo as ProtocoloLegado
from sapl.norma.models import AssuntoNorma, NormaJuridica
from sapl.parlamentares.models import Parlamentar
from sapl.protocoloadm.models import Protocolo, StatusTramitacaoAdministrativo

3
sapl/legacy_migration_settings.py

@ -1,11 +1,10 @@
import os
from decouple import Config, RepositoryEnv, AutoConfig
from decouple import AutoConfig, Config, RepositoryEnv
from dj_database_url import parse as db_url
from .settings import * # flake8: noqa
config = AutoConfig()
config.config = Config(RepositoryEnv(os.path.abspath('sapl/legacy/.env')))

4
sapl/materia/forms.py

@ -1,11 +1,9 @@
import os
from datetime import date, datetime
from itertools import chain
import django_filters
from crispy_forms.bootstrap import (Alert, FormActions, InlineCheckboxes,
InlineRadios)
from crispy_forms.bootstrap import Alert, FormActions, InlineRadios
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset,
Layout, Submit)

5
sapl/materia/models.py

@ -11,14 +11,13 @@ from model_utils import Choices
from sapl.base.models import Autor
from sapl.comissoes.models import Comissao
from sapl.compilacao.models import TextoArticulado,\
PerfilEstruturalTextoArticulado
from sapl.compilacao.models import (PerfilEstruturalTextoArticulado,
TextoArticulado)
from sapl.parlamentares.models import Parlamentar
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, SaplGenericForeignKey,
SaplGenericRelation, restringe_tipos_de_arquivo_txt,
texto_upload_path)
EM_TRAMITACAO = [(1, 'Sim'),
(0, 'Não')]

3
sapl/materia/views.py

@ -16,8 +16,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.template import Context, loader
from django.utils import formats
from django.utils.translation import ugettext_lazy as _
from django.views.generic import (CreateView, DetailView, ListView,
TemplateView, UpdateView)
from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView
from django_filters.views import FilterView

2
sapl/norma/forms.py

@ -1,5 +1,6 @@
from datetime import datetime
import django_filters
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Fieldset, Layout
from django import forms
@ -7,7 +8,6 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.forms import ModelForm, widgets
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa

12
sapl/painel/views.py

@ -1,11 +1,10 @@
from django.http.response import HttpResponseRedirect
from django.core.urlresolvers import reverse
from datetime import date
from sapl.utils import get_client_ip
from django.contrib.auth.decorators import user_passes_test
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import HttpResponse, JsonResponse
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
@ -17,9 +16,12 @@ from sapl.sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia,
RegistroVotacao, SessaoPlenaria,
SessaoPlenariaPresenca, VotoNominal,
VotoParlamentar)
from sapl.utils import get_client_ip
from .models import Cronometro
VOTACAO_NOMINAL = 2
CronometroPainelCrud = Crud.build(Cronometro, '')
# FIXME mudar lógica
@ -49,7 +51,7 @@ def votante_view(request, pk):
if ordem_dia:
materia = ordem_dia.materia
if ordem_dia.tipo_votacao == 2:
if ordem_dia.tipo_votacao == VOTACAO_NOMINAL:
context.update({'materia': materia, 'ementa': materia.ementa})
presentes = PresencaOrdemDia.objects.filter(sessao_plenaria_id=pk)
else:
@ -57,7 +59,7 @@ def votante_view(request, pk):
{'materia': 'A matéria aberta não é votação nominal.'})
elif expediente:
materia = expediente.materia
if expediente.tipo_votacao == 2:
if expediente.tipo_votacao == VOTACAO_NOMINAL:
context.update({'materia': materia, 'ementa': materia.ementa})
presentes = SessaoPlenariaPresenca.objects.filter(
sessao_plenaria_id=pk)

2
sapl/parlamentares/apps.py

@ -1,6 +1,4 @@
from django import apps
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_migrate
from django.utils.translation import ugettext_lazy as _

3
sapl/parlamentares/forms.py

@ -3,8 +3,7 @@ from datetime import date, timedelta
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Fieldset, Layout
from django import forms
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
from django.contrib.auth.models import Group, User
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import Q

1
sapl/parlamentares/models.py

@ -5,7 +5,6 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from sapl.api import permissions
from sapl.base.models import Autor
from sapl.utils import (INDICADOR_AFASTAMENTO, UF, YES_NO_CHOICES,
SaplGenericRelation, intervalos_tem_intersecao,

8
sapl/parlamentares/views.py

@ -12,7 +12,6 @@ from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud)
from sapl.materia.models import Proposicao, Relatoria
from sapl.parlamentares.apps import AppConfig
from sapl.utils import get_client_ip
from .forms import (FiliacaoForm, LegislaturaCreateForm, LegislaturaUpdateForm,
ParlamentarCreateForm, ParlamentarForm, VotanteForm)
@ -106,7 +105,8 @@ class ProposicaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView):
class ListView(CrudBaseForListAndDetailExternalAppView.ListView):
def get_context_data(self, **kwargs):
context = CrudBaseForListAndDetailExternalAppView.ListView.get_context_data(self, **kwargs)
context = CrudBaseForListAndDetailExternalAppView\
.ListView.get_context_data(self, **kwargs)
context['title'] = context['title'].replace(
'Proposições', 'Matérias')
return context
@ -385,8 +385,8 @@ class MesaDiretoraView(FormView):
def existe_membro_mesa(self, sessao_plenaria, cargo):
return ComposicaoMesa.objects.filter(
sessao_legislativa_id=sessao_plenaria.id,
#parlamentar_id = integrante.parlamentar_id,
cargo_id = cargo.id
# parlamentar_id = integrante.parlamentar_id,
cargo_id=cargo.id
).exists()
def post(self, request, *args, **kwargs):

4
sapl/protocoloadm/views.py

@ -92,7 +92,7 @@ class ProtocoloPesquisaView(PermissionRequiredMixin, FilterView):
qs = self.get_queryset().order_by('ano', 'numero')
qs = qs.distinct()
if 'o' in self.request.GET and not self.request.GET['o']:
qs = qs.order_by('-ano', '-numero')
@ -406,7 +406,7 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin,
qs = self.get_queryset()
qs = qs.distinct()
if 'o' in self.request.GET and not self.request.GET['o']:
qs = qs.order_by('-ano', '-numero')

4
sapl/rules/apps.py

@ -1,5 +1,6 @@
from builtins import LookupError
import django
from django.apps import apps
from django.conf import settings
from django.contrib.auth import get_user_model
@ -7,9 +8,8 @@ from django.contrib.auth.management import _get_all_permissions
from django.core import exceptions
from django.db import models, router
from django.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
import django
from django.utils.translation import string_concat
from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES,
SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA,

8
sapl/rules/map_rules.py

@ -7,15 +7,14 @@ from sapl.norma import models as norma
from sapl.painel import models as painel
from sapl.parlamentares import models as parlamentares
from sapl.protocoloadm import models as protocoloadm
from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_ANONYMOUS,
from sapl.rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL, RP_LIST,
SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_ANONYMOUS,
SAPL_GROUP_AUTOR, SAPL_GROUP_COMISSOES,
SAPL_GROUP_GERAL, SAPL_GROUP_LOGIN_SOCIAL,
SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA,
SAPL_GROUP_PAINEL, SAPL_GROUP_PARLAMENTAR,
SAPL_GROUP_PROTOCOLO, SAPL_GROUP_SESSAO,
RP_LIST, RP_DETAIL, RP_ADD, RP_CHANGE, RP_DELETE,
SAPL_GROUP_VOTANTE)
from sapl.sessao import models as sessao
"""
@ -111,7 +110,8 @@ rules_group_materia = {
# quando testes forem feitos para permtir que matérias possam
# ser vinculadas a outras matérias via registro de compilação.
# Normalmente emendas e/ou projetos substitutivos podem alterar
# uma matéria original. Fazer esse registro de compilação ofereceria
# uma matéria original.
# Fazer esse registro de compilação ofereceria
# um autografo eletrônico pronto para ser convertido em Norma.
])
]

4
sapl/sessao/models.py

@ -85,6 +85,7 @@ def ata_upload_path(instance, filename):
return texto_upload_path(instance, filename, subpath='ata')
# return get_sessao_media_path(instance, 'ata', filename)
def anexo_upload_path(instance, filename):
return texto_upload_path(instance, filename, subpath='anexo')
# return get_sessao_media_path(instance, 'anexo', filename)
@ -171,7 +172,8 @@ class SessaoPlenaria(models.Model):
def save(self, force_insert=False, force_update=False, using=None,
update_fields=None):
if not self.pk and (self.upload_pauta or self.upload_ata or self.upload_anexo):
if not self.pk and (self.upload_pauta or
self.upload_ata or self.upload_anexo):
upload_pauta = self.upload_pauta
upload_ata = self.upload_ata
upload_anexo = self.upload_anexo

1
sapl/settings.py

@ -14,7 +14,6 @@ See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
"""
import logging
import sys
from decouple import config
from dj_database_url import parse as db_url

5
sapl/test_urls.py

@ -1,12 +1,12 @@
import pytest
from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.auth.management import _get_all_permissions
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
import pytest
from django.utils.translation import string_concat
from sapl.crud.base import PermissionRequiredForAppCrudMixin
from sapl.rules.apps import AppConfig, update_groups
@ -14,7 +14,6 @@ from scripts.lista_urls import lista_urls
from .settings import SAPL_APPS
pytestmark = pytest.mark.django_db
sapl_appconfs = [apps.get_app_config(n[5:]) for n in SAPL_APPS]

3
sapl/urls.py

@ -17,7 +17,7 @@ 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 TemplateView, RedirectView
from django.views.generic.base import RedirectView, TemplateView
from django.views.static import serve as view_static_server
import sapl.api.urls
@ -33,7 +33,6 @@ import sapl.protocoloadm.urls
import sapl.relatorios.urls
import sapl.sessao.urls
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html')),
url(r'^message$', TemplateView.as_view(template_name='base.html')),

11
sapl/utils.py

@ -1,10 +1,12 @@
from datetime import date
from functools import wraps
from unicodedata import normalize as unicodedata_normalize
import hashlib
import logging
import re
from datetime import date
from functools import wraps
from unicodedata import normalize as unicodedata_normalize
import django_filters
import magic
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button
from django import forms
@ -16,13 +18,10 @@ from django.contrib.contenttypes.fields import (GenericForeignKey, GenericRel,
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from floppyforms import ClearableFileInput
import django_filters
import magic
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.settings import BASE_DIR
sapl_logger = logging.getLogger(BASE_DIR.name)

Loading…
Cancel
Save