diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..9a70ef5bd --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include README.rst LICENSE.txt +recursive-include sapl *.html *.yaml +recursive-include sapl/static * +recursive-include sapl/relatorios/templates *.py +global-exclude __pycache__ +global-exclude *.py[co] diff --git a/README.rst b/README.rst index bb146f762..9770c0015 100644 --- a/README.rst +++ b/README.rst @@ -244,10 +244,20 @@ Boas Práticas - Execute ``./manage.py check`` - Execute todos os testes com ``py.test`` na pasta raiz do projeto -* Em caso de Implementação de modelo que envolva a classe from django.contrib.auth.models.User, não a use diretamente, use para isso a função get_user_model() de sapl.utils. Exemplo: +* Em caso de Implementação de modelo que envolva a classe ``django.contrib.auth.models.User``, não a use diretamente, use para isso a função ``get_settings_auth_user_model()`` de ``sapl.utils``. Exemplo: - - no lugar de ``owner = models.ForeignKey(User, ... )`` - - use ``owner = models.ForeignKey(get_user_model(), ... )`` + - no lugar de ``owner = models.ForeignKey(User, ... )`` + - use ``owner = models.ForeignKey(get_settings_auth_user_model(), ... )`` + + - Não use em qualquer modelagem futura, ``ForeignKey`` com ``User`` ou mesmo ``settings.AUTH_USER_MODEL`` sem o import correto que não é o do projeto e sim o que está em ``sapl.utils``, ou seja (``from django.conf import settings``) + + - em https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#referencing-the-user-model é explicado por que ser dessa forma! + + - Já em qualquer uso em implementação de execução, ao fazer uma query, por exemplo: + + - não use ``django.contrib.auth.models.User`` para utilizar as caracteristicas do model, para isso, use esta função: django.contrib.auth.get_user_model() + + - Seguir esses passos simplificará qualquer customização futura que venha a ser feita na autenticação do usuários ao evitar correções de inúmeros import's e ainda, desta forma, torna a funcionalidade de autenticação reimplementável por qualquer outro projeto que venha usar partes ou o todo do SAPL. Atenção: diff --git a/base/__init__.py b/base/__init__.py deleted file mode 100644 index bbf993376..000000000 --- a/base/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'base.apps.AppConfig' diff --git a/comissoes/__init__.py b/comissoes/__init__.py deleted file mode 100644 index 78f813284..000000000 --- a/comissoes/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'comissoes.apps.AppConfig' diff --git a/lexml/__init__.py b/lexml/__init__.py deleted file mode 100644 index b9a440a35..000000000 --- a/lexml/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'lexml.apps.AppConfig' diff --git a/materia/__init__.py b/materia/__init__.py deleted file mode 100644 index 7d2cd33d2..000000000 --- a/materia/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'materia.apps.AppConfig' diff --git a/norma/__init__.py b/norma/__init__.py deleted file mode 100644 index 5c4701e00..000000000 --- a/norma/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'norma.apps.AppConfig' diff --git a/painel/__init__.py b/painel/__init__.py deleted file mode 100644 index 1eedfa389..000000000 --- a/painel/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'painel.apps.AppConfig' diff --git a/parlamentares/__init__.py b/parlamentares/__init__.py deleted file mode 100644 index ffec8e2fb..000000000 --- a/parlamentares/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'parlamentares.apps.AppConfig' diff --git a/protocoloadm/__init__.py b/protocoloadm/__init__.py deleted file mode 100644 index c9bbe85bf..000000000 --- a/protocoloadm/__init__.py +++ /dev/null @@ -1 +0,0 @@ -default_app_config = 'protocoloadm.apps.AppConfig' diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 4ff777ebd..2af641724 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -23,4 +23,4 @@ pyyaml==3.11 rtyaml==0.0.2 unipath==1.1 python-magic==0.4.10 -gunicorn==19.4.5 \ No newline at end of file +gunicorn==19.4.5 diff --git a/sapl/base/__init__.py b/sapl/base/__init__.py new file mode 100644 index 000000000..1c70462e6 --- /dev/null +++ b/sapl/base/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.base.apps.AppConfig' diff --git a/base/admin.py b/sapl/base/admin.py similarity index 94% rename from base/admin.py rename to sapl/base/admin.py index b952b349c..ae581e031 100644 --- a/base/admin.py +++ b/sapl/base/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import reverse -from base.models import ProblemaMigracao +from sapl.base.models import ProblemaMigracao from sapl.utils import register_all_models_in_admin register_all_models_in_admin(__name__) diff --git a/base/apps.py b/sapl/base/apps.py similarity index 78% rename from base/apps.py rename to sapl/base/apps.py index cb73158bb..be67eee9e 100644 --- a/base/apps.py +++ b/sapl/base/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'base' + name = 'sapl.base' + label = 'base' verbose_name = _('Dados Básicos') diff --git a/base/forms.py b/sapl/base/forms.py similarity index 71% rename from base/forms.py rename to sapl/base/forms.py index e0f097096..5f69f086c 100644 --- a/base/forms.py +++ b/sapl/base/forms.py @@ -3,8 +3,8 @@ from django.contrib.auth.forms import AuthenticationForm from django.core.exceptions import ValidationError from django.forms import ModelForm -import sapl from sapl.settings import MAX_IMAGE_UPLOAD_SIZE +from sapl.utils import ImageThumbnailFileInput from .models import CasaLegislativa @@ -33,7 +33,7 @@ class CasaLegislativaForm(ModelForm): 'cep': forms.TextInput(attrs={'class': 'cep'}), 'telefone': forms.TextInput(attrs={'class': 'telefone'}), 'fax': forms.TextInput(attrs={'class': 'telefone'}), - 'logotipo': sapl.utils.ImageThumbnailFileInput, + 'logotipo': ImageThumbnailFileInput, 'informacao_geral': forms.Textarea( attrs={'id': 'texto-rico'}) } @@ -47,11 +47,13 @@ class CasaLegislativaForm(ModelForm): class LoginForm(AuthenticationForm): - username = forms.CharField(label="Username", max_length=30, - widget=forms.TextInput( - attrs={ - 'class': 'form-control', 'name': 'username'})) - password = forms.CharField(label="Password", max_length=30, - widget=forms.PasswordInput( - attrs={ - 'class': 'form-control', 'name': 'password'})) + username = forms.CharField( + label="Username", max_length=30, + widget=forms.TextInput( + attrs={ + 'class': 'form-control', 'name': 'username'})) + password = forms.CharField( + label="Password", max_length=30, + widget=forms.PasswordInput( + attrs={ + 'class': 'form-control', 'name': 'password'})) diff --git a/base/layouts.yaml b/sapl/base/layouts.yaml similarity index 100% rename from base/layouts.yaml rename to sapl/base/layouts.yaml diff --git a/base/migrations/0001_initial.py b/sapl/base/migrations/0001_initial.py similarity index 100% rename from base/migrations/0001_initial.py rename to sapl/base/migrations/0001_initial.py diff --git a/base/migrations/0002_casalegislativa_codigo.py b/sapl/base/migrations/0002_casalegislativa_codigo.py similarity index 100% rename from base/migrations/0002_casalegislativa_codigo.py rename to sapl/base/migrations/0002_casalegislativa_codigo.py diff --git a/base/migrations/0003_auto_20160107_1122.py b/sapl/base/migrations/0003_auto_20160107_1122.py similarity index 67% rename from base/migrations/0003_auto_20160107_1122.py rename to sapl/base/migrations/0003_auto_20160107_1122.py index 5e930a3c2..fb8dd51bd 100644 --- a/base/migrations/0003_auto_20160107_1122.py +++ b/sapl/base/migrations/0003_auto_20160107_1122.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import base.models +import sapl.base.models class Migration(migrations.Migration): @@ -15,6 +15,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='casalegislativa', name='logotipo', - field=models.FileField(null=True, upload_to=base.models.get_casa_media_path, verbose_name='Logotipo', blank=True), + field=models.FileField( + null=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo', blank=True), ), ] diff --git a/base/migrations/0004_auto_20160107_1158.py b/sapl/base/migrations/0004_auto_20160107_1158.py similarity index 100% rename from base/migrations/0004_auto_20160107_1158.py rename to sapl/base/migrations/0004_auto_20160107_1158.py diff --git a/base/migrations/0005_auto_20160107_1244.py b/sapl/base/migrations/0005_auto_20160107_1244.py similarity index 100% rename from base/migrations/0005_auto_20160107_1244.py rename to sapl/base/migrations/0005_auto_20160107_1244.py diff --git a/base/migrations/0006_auto_20160107_1257.py b/sapl/base/migrations/0006_auto_20160107_1257.py similarity index 100% rename from base/migrations/0006_auto_20160107_1257.py rename to sapl/base/migrations/0006_auto_20160107_1257.py diff --git a/base/migrations/0007_auto_20160107_1837.py b/sapl/base/migrations/0007_auto_20160107_1837.py similarity index 61% rename from base/migrations/0007_auto_20160107_1837.py rename to sapl/base/migrations/0007_auto_20160107_1837.py index 9c102a411..58714badf 100644 --- a/base/migrations/0007_auto_20160107_1837.py +++ b/sapl/base/migrations/0007_auto_20160107_1837.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations -import base.models +import sapl.base.models class Migration(migrations.Migration): @@ -15,11 +15,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='casalegislativa', name='informacao_geral', - field=models.CharField(blank=True, max_length=100, verbose_name='Informação Geral', null=True), + field=models.CharField( + blank=True, max_length=100, verbose_name='Informação Geral', null=True), ), migrations.AlterField( model_name='casalegislativa', name='logotipo', - field=models.ImageField(blank=True, upload_to=base.models.get_casa_media_path, verbose_name='Logotipo', null=True), + field=models.ImageField( + blank=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo', null=True), ), ] diff --git a/base/migrations/0008_auto_20160216_1015.py b/sapl/base/migrations/0008_auto_20160216_1015.py similarity index 60% rename from base/migrations/0008_auto_20160216_1015.py rename to sapl/base/migrations/0008_auto_20160216_1015.py index de03c79df..d969a82e0 100644 --- a/base/migrations/0008_auto_20160216_1015.py +++ b/sapl/base/migrations/0008_auto_20160216_1015.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations import datetime + +from django.db import models, migrations from django.utils.timezone import utc -import base.models + +import sapl.base.models class Migration(migrations.Migration): @@ -17,32 +19,38 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='casalegislativa', name='email', - field=models.CharField(verbose_name='E-mail', max_length=100, default=datetime.datetime(2016, 2, 16, 12, 15, 30, 241941, tzinfo=utc), blank=True), + field=models.CharField(verbose_name='E-mail', max_length=100, default=datetime.datetime( + 2016, 2, 16, 12, 15, 30, 241941, tzinfo=utc), blank=True), preserve_default=False, ), migrations.AlterField( model_name='casalegislativa', name='endereco_web', - field=models.CharField(verbose_name='HomePage', max_length=100, blank=True), + field=models.CharField( + verbose_name='HomePage', max_length=100, blank=True), ), migrations.AlterField( model_name='casalegislativa', name='fax', - field=models.CharField(verbose_name='Fax', max_length=100, blank=True), + field=models.CharField( + verbose_name='Fax', max_length=100, blank=True), ), migrations.AlterField( model_name='casalegislativa', name='informacao_geral', - field=models.CharField(verbose_name='Informação Geral', max_length=100, blank=True), + field=models.CharField( + verbose_name='Informação Geral', max_length=100, blank=True), ), migrations.AlterField( model_name='casalegislativa', name='logotipo', - field=models.ImageField(verbose_name='Logotipo', upload_to=base.models.get_casa_media_path, blank=True), + field=models.ImageField( + verbose_name='Logotipo', upload_to=sapl.base.models.get_casa_media_path, blank=True), ), migrations.AlterField( model_name='casalegislativa', name='telefone', - field=models.CharField(verbose_name='Telefone', max_length=100, blank=True), + field=models.CharField( + verbose_name='Telefone', max_length=100, blank=True), ), ] diff --git a/base/migrations/0009_auto_20160307_0905.py b/sapl/base/migrations/0009_auto_20160307_0905.py similarity index 100% rename from base/migrations/0009_auto_20160307_0905.py rename to sapl/base/migrations/0009_auto_20160307_0905.py diff --git a/base/migrations/0010_auto_20160309_1323.py b/sapl/base/migrations/0010_auto_20160309_1323.py similarity index 100% rename from base/migrations/0010_auto_20160309_1323.py rename to sapl/base/migrations/0010_auto_20160309_1323.py diff --git a/base/migrations/0011_problemamigracao.py b/sapl/base/migrations/0011_problemamigracao.py similarity index 100% rename from base/migrations/0011_problemamigracao.py rename to sapl/base/migrations/0011_problemamigracao.py diff --git a/base/migrations/0012_problemamigracao_eh_stub.py b/sapl/base/migrations/0012_problemamigracao_eh_stub.py similarity index 100% rename from base/migrations/0012_problemamigracao_eh_stub.py rename to sapl/base/migrations/0012_problemamigracao_eh_stub.py diff --git a/base/migrations/0013_remove_problemamigracao_endereco.py b/sapl/base/migrations/0013_remove_problemamigracao_endereco.py similarity index 100% rename from base/migrations/0013_remove_problemamigracao_endereco.py rename to sapl/base/migrations/0013_remove_problemamigracao_endereco.py diff --git a/base/migrations/0014_auto_20160502_1635.py b/sapl/base/migrations/0014_auto_20160502_1635.py similarity index 100% rename from base/migrations/0014_auto_20160502_1635.py rename to sapl/base/migrations/0014_auto_20160502_1635.py diff --git a/base/migrations/0015_problemamigracao_nome_campo.py b/sapl/base/migrations/0015_problemamigracao_nome_campo.py similarity index 100% rename from base/migrations/0015_problemamigracao_nome_campo.py rename to sapl/base/migrations/0015_problemamigracao_nome_campo.py diff --git a/base/migrations/__init__.py b/sapl/base/migrations/__init__.py similarity index 100% rename from base/migrations/__init__.py rename to sapl/base/migrations/__init__.py diff --git a/base/models.py b/sapl/base/models.py similarity index 98% rename from base/models.py rename to sapl/base/models.py index 30a916c0c..b2310d566 100644 --- a/base/models.py +++ b/sapl/base/models.py @@ -7,7 +7,7 @@ from sapl.utils import UF def get_sessao_media_path(instance, subpath, filename): - return './casa/%s/%s' % (subpath, filename) + return './sapl/casa/%s/%s' % (subpath, filename) def get_casa_media_path(instance, filename): diff --git a/base/templatetags/__init__.py b/sapl/base/templatetags/__init__.py similarity index 100% rename from base/templatetags/__init__.py rename to sapl/base/templatetags/__init__.py diff --git a/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py similarity index 100% rename from base/templatetags/common_tags.py rename to sapl/base/templatetags/common_tags.py diff --git a/base/templatetags/menus.py b/sapl/base/templatetags/menus.py similarity index 51% rename from base/templatetags/menus.py rename to sapl/base/templatetags/menus.py index 69212fbe7..d96ab2e22 100644 --- a/base/templatetags/menus.py +++ b/sapl/base/templatetags/menus.py @@ -1,13 +1,11 @@ import os -import yaml from django import template from django.core.urlresolvers import reverse +import yaml -from sapl.settings import BASE_DIR register = template.Library() -TEMPLATES_DIR = BASE_DIR.child("templates") @register.inclusion_tag('menus/subnav.html', takes_context=True) @@ -24,32 +22,34 @@ def subnav(context, path=None): obj = context.get('object', None) if obj: root_pk = obj.pk + if root_pk: request = context['request'] - app = request.resolver_match.app_name - # Esse IF elimina o bug que ocorria nas Tabelas Auxiliares - # Algumas recebiam a nav-bar de seu app gerada pelo APP CRUD - # Essa nav-bar é indesejada nesses casos - # A solução encontrada foi verificar se havia 'sistema' na URL - # ou se o nome do app estava presente na URL - # Para essa Solução haviam duas exceções, pois o nome base das URLs - # de comissões e parlamentares são diferentes do nome do app - # Deve-se cuidar para que o nome base das URLs sejam - # iguais ao nome do app Ex: app = 'parlamentares' e - # url = 'parlamentares/...' - if (request.path.find('parlamentar') != -1 and - app == 'parlamentares' or - request.path.find('comissao') != -1 and app == 'comissoes'): - pass - elif (request.path.find(app) == -1 or - request.path.find('sistema') != -1): + if 'sistema' in request.path: return - default_path = '%s/subnav.yaml' % app - path = os.path.join(TEMPLATES_DIR, path or default_path) - if os.path.exists(path): - menu = yaml.load(open(path, 'r')) + + app = request.resolver_match.app_name + app_template = app.split('.') + app_template = app_template[1] if app_template[ + 0] == 'sapl' and len(app_template) > 1 else app_template[0] + + yaml_path = '%s/subnav.yaml' % app_template + + try: + """ Por padrão, são carragados dois Loaders, + filesystem.Loader - busca em TEMPLATES_DIRS do projeto atual + app_directories.Loader - busca em todas apps instaladas + A função abaixo é nativa e busca em todos os Loaders Configurados. + """ + yaml_template = template.loader.get_template(yaml_path) + menu = yaml.load(open(yaml_template.origin.name, 'r')) resolve_urls_inplace(menu, root_pk, app) + except: + # um erro será lançado por get_template se não for encontrado + # yaml_path em nenhum de locais registrados. + pass + return {'menu': menu} diff --git a/base/tests/test_login.py b/sapl/base/tests/test_login.py similarity index 92% rename from base/tests/test_login.py rename to sapl/base/tests/test_login.py index 819d027a4..40ad93264 100755 --- a/base/tests/test_login.py +++ b/sapl/base/tests/test_login.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- +from django.contrib.auth import get_user_model import pytest -from django.contrib.auth.models import User + pytestmark = pytest.mark.django_db @pytest.fixture def user(): - return User.objects.create_user('jfirmino', password='123') + return get_user_model().objects.create_user('jfirmino', password='123') def test_login_aparece_na_barra_para_usuario_nao_logado(client): @@ -35,7 +36,7 @@ def test_nome_completo_do_usuario_logado_aparece_na_barra(client, user): assert 'Sair' in str(response.content) -@pytest.mark.urls('base.tests.teststub_urls') +@pytest.mark.urls('sapl.base.tests.teststub_urls') @pytest.mark.parametrize("link_login,destino", [ # login redireciona para home ('/login/', '/'), diff --git a/base/tests/teststub_urls.py b/sapl/base/tests/teststub_urls.py similarity index 100% rename from base/tests/teststub_urls.py rename to sapl/base/tests/teststub_urls.py diff --git a/base/urls.py b/sapl/base/urls.py similarity index 100% rename from base/urls.py rename to sapl/base/urls.py diff --git a/base/views.py b/sapl/base/views.py similarity index 75% rename from base/views.py rename to sapl/base/views.py index 119e81d8b..80168103f 100644 --- a/base/views.py +++ b/sapl/base/views.py @@ -1,7 +1,6 @@ from django.views.generic.base import TemplateView -import crud.base -from crud.base import Crud +from sapl.crud.base import Crud, CrudBaseMixin, CrudCreateView, CrudUpdateView from .forms import CasaLegislativaForm from .models import CasaLegislativa @@ -15,13 +14,13 @@ class CasaLegislativaCrud(Crud): model = CasaLegislativa help_path = '' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['codigo', 'nome', 'sigla'] - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = CasaLegislativaForm - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = CasaLegislativaForm diff --git a/sapl/comissoes/__init__.py b/sapl/comissoes/__init__.py new file mode 100644 index 000000000..c5e8153a3 --- /dev/null +++ b/sapl/comissoes/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.comissoes.apps.AppConfig' diff --git a/comissoes/admin.py b/sapl/comissoes/admin.py similarity index 100% rename from comissoes/admin.py rename to sapl/comissoes/admin.py diff --git a/comissoes/apps.py b/sapl/comissoes/apps.py similarity index 74% rename from comissoes/apps.py rename to sapl/comissoes/apps.py index e37de82c1..18cb03041 100644 --- a/comissoes/apps.py +++ b/sapl/comissoes/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'comissoes' + name = 'sapl.comissoes' + label = 'comissoes' verbose_name = _('Comissões') diff --git a/comissoes/forms.py b/sapl/comissoes/forms.py similarity index 100% rename from comissoes/forms.py rename to sapl/comissoes/forms.py diff --git a/comissoes/layouts.yaml b/sapl/comissoes/layouts.yaml similarity index 100% rename from comissoes/layouts.yaml rename to sapl/comissoes/layouts.yaml diff --git a/comissoes/legacy.yaml b/sapl/comissoes/legacy.yaml similarity index 100% rename from comissoes/legacy.yaml rename to sapl/comissoes/legacy.yaml diff --git a/comissoes/migrations/0001_initial.py b/sapl/comissoes/migrations/0001_initial.py similarity index 100% rename from comissoes/migrations/0001_initial.py rename to sapl/comissoes/migrations/0001_initial.py diff --git a/comissoes/migrations/0002_auto_20150729_1310.py b/sapl/comissoes/migrations/0002_auto_20150729_1310.py similarity index 100% rename from comissoes/migrations/0002_auto_20150729_1310.py rename to sapl/comissoes/migrations/0002_auto_20150729_1310.py diff --git a/comissoes/migrations/0003_auto_20160216_1015.py b/sapl/comissoes/migrations/0003_auto_20160216_1015.py similarity index 100% rename from comissoes/migrations/0003_auto_20160216_1015.py rename to sapl/comissoes/migrations/0003_auto_20160216_1015.py diff --git a/comissoes/migrations/0004_auto_20160307_0905.py b/sapl/comissoes/migrations/0004_auto_20160307_0905.py similarity index 100% rename from comissoes/migrations/0004_auto_20160307_0905.py rename to sapl/comissoes/migrations/0004_auto_20160307_0905.py diff --git a/comissoes/migrations/__init__.py b/sapl/comissoes/migrations/__init__.py similarity index 100% rename from comissoes/migrations/__init__.py rename to sapl/comissoes/migrations/__init__.py diff --git a/comissoes/models.py b/sapl/comissoes/models.py similarity index 99% rename from comissoes/models.py rename to sapl/comissoes/models.py index 24c476c44..b5ca44d31 100644 --- a/comissoes/models.py +++ b/sapl/comissoes/models.py @@ -2,7 +2,7 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -from parlamentares.models import Parlamentar +from sapl.parlamentares.models import Parlamentar from sapl.utils import YES_NO_CHOICES diff --git a/comissoes/tests/test_comissoes.py b/sapl/comissoes/tests/test_comissoes.py similarity index 89% rename from comissoes/tests/test_comissoes.py rename to sapl/comissoes/tests/test_comissoes.py index 8d05c0a80..af5e71da7 100644 --- a/comissoes/tests/test_comissoes.py +++ b/sapl/comissoes/tests/test_comissoes.py @@ -2,8 +2,8 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from comissoes.models import Comissao, Composicao, Periodo, TipoComissao -from parlamentares.models import Filiacao, Parlamentar, Partido +from sapl.comissoes.models import Comissao, Composicao, Periodo, TipoComissao +from sapl.parlamentares.models import Filiacao, Parlamentar, Partido def make_composicao(comissao): @@ -48,7 +48,7 @@ def test_incluir_parlamentar_errors(client): comissao = make_comissao() composicao = make_composicao(comissao) - response = client.post(reverse('comissoes:participacao_create', + response = client.post(reverse('sapl.comissoes:participacao_create', kwargs={'pk': composicao.pk}), {'salvar': 'salvar'}, follow=True) @@ -67,7 +67,7 @@ def test_incluir_comissao_submit(client): sigla='T', nome='Teste') - response = client.post(reverse('comissoes:comissao_create'), + response = client.post(reverse('sapl.comissoes:comissao_create'), {'tipo': tipo.pk, 'nome': 'Comissão Teste', 'sigla': 'CT', @@ -84,7 +84,7 @@ def test_incluir_comissao_submit(client): @pytest.mark.django_db(transaction=False) def test_incluir_comissao_errors(client): - response = client.post(reverse('comissoes:comissao_create'), + response = client.post(reverse('sapl.comissoes:comissao_create'), {'salvar': 'salvar'}, follow=True) diff --git a/comissoes/urls.py b/sapl/comissoes/urls.py similarity index 74% rename from comissoes/urls.py rename to sapl/comissoes/urls.py index 075d3604d..c76fba2b6 100644 --- a/comissoes/urls.py +++ b/sapl/comissoes/urls.py @@ -1,8 +1,8 @@ from django.conf.urls import include, url -from comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud, - MateriasTramitacaoListView, ParticipacaoCrud, - PeriodoComposicaoCrud, TipoComissaoCrud) +from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud, + MateriasTramitacaoListView, ParticipacaoCrud, + PeriodoComposicaoCrud, TipoComissaoCrud) from .apps import AppConfig diff --git a/comissoes/views.py b/sapl/comissoes/views.py similarity index 86% rename from comissoes/views.py rename to sapl/comissoes/views.py index 4b4cacc96..f8ca4a813 100644 --- a/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -1,11 +1,9 @@ from django.core.urlresolvers import reverse from django.views.generic import ListView -import crud.base -import crud.masterdetail -from crud.base import Crud -from crud.masterdetail import MasterDetailCrud -from materia.models import Tramitacao +from sapl.crud.base import Crud, CrudBaseMixin +from sapl.crud.masterdetail import MasterDetailCrud +from sapl.materia.models import Tramitacao from .models import (CargoComissao, Comissao, Composicao, Participacao, Periodo, TipoComissao) @@ -18,7 +16,7 @@ TipoComissaoCrud = Crud.build(TipoComissao, 'tipo_comissao') def pegar_url_composicao(pk): participacao = Participacao.objects.get(id=pk) comp_pk = participacao.composicao.pk - url = reverse('comissoes:composicao_detail', kwargs={'pk': comp_pk}) + url = reverse('sapl.comissoes:composicao_detail', kwargs={'pk': comp_pk}) return url @@ -39,12 +37,14 @@ class ParticipacaoCrud(MasterDetailCrud): def get_success_url(self): return reverse( - 'comissoes:composicao_detail', kwargs={'pk': self.kwargs['pk']} + 'sapl.comissoes:composicao_detail', + kwargs={'pk': self.kwargs['pk']} ) def cancel_url(self): return reverse( - 'comissoes:composicao_detail', kwargs={'pk': self.kwargs['pk']} + 'sapl.comissoes:composicao_detail', + kwargs={'pk': self.kwargs['pk']} ) class UpdateView(MasterDetailCrud.UpdateView): @@ -83,7 +83,7 @@ class ComissaoCrud(Crud): model = Comissao help_path = 'modulo_comissoes' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['nome', 'sigla', 'tipo', 'data_criacao'] diff --git a/sapl/compilacao/__init__.py b/sapl/compilacao/__init__.py new file mode 100644 index 000000000..f061ea50a --- /dev/null +++ b/sapl/compilacao/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.compilacao.apps.AppConfig' diff --git a/compilacao/admin.py b/sapl/compilacao/admin.py similarity index 100% rename from compilacao/admin.py rename to sapl/compilacao/admin.py diff --git a/compilacao/apps.py b/sapl/compilacao/apps.py similarity index 73% rename from compilacao/apps.py rename to sapl/compilacao/apps.py index 5d56706ba..85c8ba349 100644 --- a/compilacao/apps.py +++ b/sapl/compilacao/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'compilacao' + name = 'sapl.compilacao' + label = 'compilacao' verbose_name = _('Compilação') diff --git a/compilacao/forms.py b/sapl/compilacao/forms.py similarity index 98% rename from compilacao/forms.py rename to sapl/compilacao/forms.py index 341983a47..29892b150 100644 --- a/compilacao/forms.py +++ b/sapl/compilacao/forms.py @@ -13,14 +13,15 @@ from django.forms.models import ModelForm from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ -from compilacao.models import (NOTAS_PUBLICIDADE_CHOICES, - PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, Nota, - Publicacao, TextoArticulado, TipoDispositivo, - TipoNota, TipoPublicacao, TipoTextoArticulado, - TipoVide, VeiculoPublicacao, Vide) -from compilacao.utils import DISPOSITIVO_SELECT_RELATED -from crispy_layout_mixin import SaplFormLayout, to_column, to_row from sapl import utils +from sapl.compilacao.models import (NOTAS_PUBLICIDADE_CHOICES, + PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, + Nota, Publicacao, TextoArticulado, + TipoDispositivo, TipoNota, TipoPublicacao, + TipoTextoArticulado, TipoVide, + VeiculoPublicacao, Vide) +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 = { diff --git a/compilacao/layouts.yaml b/sapl/compilacao/layouts.yaml similarity index 100% rename from compilacao/layouts.yaml rename to sapl/compilacao/layouts.yaml diff --git a/compilacao/migrations/0001_initial.py b/sapl/compilacao/migrations/0001_initial.py similarity index 100% rename from compilacao/migrations/0001_initial.py rename to sapl/compilacao/migrations/0001_initial.py diff --git a/compilacao/migrations/0002_auto_20150907_2334.py b/sapl/compilacao/migrations/0002_auto_20150907_2334.py similarity index 100% rename from compilacao/migrations/0002_auto_20150907_2334.py rename to sapl/compilacao/migrations/0002_auto_20150907_2334.py diff --git a/compilacao/migrations/0003_auto_20150911_1735.py b/sapl/compilacao/migrations/0003_auto_20150911_1735.py similarity index 100% rename from compilacao/migrations/0003_auto_20150911_1735.py rename to sapl/compilacao/migrations/0003_auto_20150911_1735.py diff --git a/compilacao/migrations/0004_auto_20150914_0842.py b/sapl/compilacao/migrations/0004_auto_20150914_0842.py similarity index 100% rename from compilacao/migrations/0004_auto_20150914_0842.py rename to sapl/compilacao/migrations/0004_auto_20150914_0842.py diff --git a/compilacao/migrations/0005_auto_20150924_1012.py b/sapl/compilacao/migrations/0005_auto_20150924_1012.py similarity index 100% rename from compilacao/migrations/0005_auto_20150924_1012.py rename to sapl/compilacao/migrations/0005_auto_20150924_1012.py diff --git a/compilacao/migrations/0006_auto_20150924_1121.py b/sapl/compilacao/migrations/0006_auto_20150924_1121.py similarity index 100% rename from compilacao/migrations/0006_auto_20150924_1121.py rename to sapl/compilacao/migrations/0006_auto_20150924_1121.py diff --git a/compilacao/migrations/0007_auto_20150924_1131.py b/sapl/compilacao/migrations/0007_auto_20150924_1131.py similarity index 100% rename from compilacao/migrations/0007_auto_20150924_1131.py rename to sapl/compilacao/migrations/0007_auto_20150924_1131.py diff --git a/compilacao/migrations/0008_auto_20151005_1023.py b/sapl/compilacao/migrations/0008_auto_20151005_1023.py similarity index 100% rename from compilacao/migrations/0008_auto_20151005_1023.py rename to sapl/compilacao/migrations/0008_auto_20151005_1023.py diff --git a/compilacao/migrations/0009_auto_20151007_1635.py b/sapl/compilacao/migrations/0009_auto_20151007_1635.py similarity index 100% rename from compilacao/migrations/0009_auto_20151007_1635.py rename to sapl/compilacao/migrations/0009_auto_20151007_1635.py diff --git a/compilacao/migrations/0010_auto_20151105_1532.py b/sapl/compilacao/migrations/0010_auto_20151105_1532.py similarity index 100% rename from compilacao/migrations/0010_auto_20151105_1532.py rename to sapl/compilacao/migrations/0010_auto_20151105_1532.py diff --git a/compilacao/migrations/0011_auto_20151105_1540.py b/sapl/compilacao/migrations/0011_auto_20151105_1540.py similarity index 100% rename from compilacao/migrations/0011_auto_20151105_1540.py rename to sapl/compilacao/migrations/0011_auto_20151105_1540.py diff --git a/compilacao/migrations/0012_auto_20151105_1658.py b/sapl/compilacao/migrations/0012_auto_20151105_1658.py similarity index 100% rename from compilacao/migrations/0012_auto_20151105_1658.py rename to sapl/compilacao/migrations/0012_auto_20151105_1658.py diff --git a/compilacao/migrations/0013_auto_20151106_1843.py b/sapl/compilacao/migrations/0013_auto_20151106_1843.py similarity index 100% rename from compilacao/migrations/0013_auto_20151106_1843.py rename to sapl/compilacao/migrations/0013_auto_20151106_1843.py diff --git a/compilacao/migrations/0014_auto_20151107_1836.py b/sapl/compilacao/migrations/0014_auto_20151107_1836.py similarity index 100% rename from compilacao/migrations/0014_auto_20151107_1836.py rename to sapl/compilacao/migrations/0014_auto_20151107_1836.py diff --git a/compilacao/migrations/0015_auto_20151115_2310.py b/sapl/compilacao/migrations/0015_auto_20151115_2310.py similarity index 100% rename from compilacao/migrations/0015_auto_20151115_2310.py rename to sapl/compilacao/migrations/0015_auto_20151115_2310.py diff --git a/compilacao/migrations/0016_auto_20151119_0950.py b/sapl/compilacao/migrations/0016_auto_20151119_0950.py similarity index 100% rename from compilacao/migrations/0016_auto_20151119_0950.py rename to sapl/compilacao/migrations/0016_auto_20151119_0950.py diff --git a/compilacao/migrations/0017_auto_20151119_1035.py b/sapl/compilacao/migrations/0017_auto_20151119_1035.py similarity index 100% rename from compilacao/migrations/0017_auto_20151119_1035.py rename to sapl/compilacao/migrations/0017_auto_20151119_1035.py diff --git a/compilacao/migrations/0018_auto_20151119_1052.py b/sapl/compilacao/migrations/0018_auto_20151119_1052.py similarity index 100% rename from compilacao/migrations/0018_auto_20151119_1052.py rename to sapl/compilacao/migrations/0018_auto_20151119_1052.py diff --git a/compilacao/migrations/0019_auto_20151119_1120.py b/sapl/compilacao/migrations/0019_auto_20151119_1120.py similarity index 100% rename from compilacao/migrations/0019_auto_20151119_1120.py rename to sapl/compilacao/migrations/0019_auto_20151119_1120.py diff --git a/compilacao/migrations/0020_auto_20151119_1126.py b/sapl/compilacao/migrations/0020_auto_20151119_1126.py similarity index 100% rename from compilacao/migrations/0020_auto_20151119_1126.py rename to sapl/compilacao/migrations/0020_auto_20151119_1126.py diff --git a/compilacao/migrations/0021_auto_20151119_1617.py b/sapl/compilacao/migrations/0021_auto_20151119_1617.py similarity index 100% rename from compilacao/migrations/0021_auto_20151119_1617.py rename to sapl/compilacao/migrations/0021_auto_20151119_1617.py diff --git a/compilacao/migrations/0022_auto_20151120_1503.py b/sapl/compilacao/migrations/0022_auto_20151120_1503.py similarity index 100% rename from compilacao/migrations/0022_auto_20151120_1503.py rename to sapl/compilacao/migrations/0022_auto_20151120_1503.py diff --git a/compilacao/migrations/0023_auto_20151120_1529.py b/sapl/compilacao/migrations/0023_auto_20151120_1529.py similarity index 100% rename from compilacao/migrations/0023_auto_20151120_1529.py rename to sapl/compilacao/migrations/0023_auto_20151120_1529.py diff --git a/compilacao/migrations/0024_auto_20151120_1814.py b/sapl/compilacao/migrations/0024_auto_20151120_1814.py similarity index 100% rename from compilacao/migrations/0024_auto_20151120_1814.py rename to sapl/compilacao/migrations/0024_auto_20151120_1814.py diff --git a/compilacao/migrations/0025_auto_20151122_1744.py b/sapl/compilacao/migrations/0025_auto_20151122_1744.py similarity index 100% rename from compilacao/migrations/0025_auto_20151122_1744.py rename to sapl/compilacao/migrations/0025_auto_20151122_1744.py diff --git a/compilacao/migrations/0026_auto_20151122_1756.py b/sapl/compilacao/migrations/0026_auto_20151122_1756.py similarity index 100% rename from compilacao/migrations/0026_auto_20151122_1756.py rename to sapl/compilacao/migrations/0026_auto_20151122_1756.py diff --git a/compilacao/migrations/0027_auto_20151130_1632.py b/sapl/compilacao/migrations/0027_auto_20151130_1632.py similarity index 100% rename from compilacao/migrations/0027_auto_20151130_1632.py rename to sapl/compilacao/migrations/0027_auto_20151130_1632.py diff --git a/compilacao/migrations/0028_auto_20151201_0042.py b/sapl/compilacao/migrations/0028_auto_20151201_0042.py similarity index 100% rename from compilacao/migrations/0028_auto_20151201_0042.py rename to sapl/compilacao/migrations/0028_auto_20151201_0042.py diff --git a/compilacao/migrations/0029_auto_20151201_1611.py b/sapl/compilacao/migrations/0029_auto_20151201_1611.py similarity index 100% rename from compilacao/migrations/0029_auto_20151201_1611.py rename to sapl/compilacao/migrations/0029_auto_20151201_1611.py diff --git a/compilacao/migrations/0030_auto_20151203_1114.py b/sapl/compilacao/migrations/0030_auto_20151203_1114.py similarity index 100% rename from compilacao/migrations/0030_auto_20151203_1114.py rename to sapl/compilacao/migrations/0030_auto_20151203_1114.py diff --git a/compilacao/migrations/0030_auto_20151203_1117.py b/sapl/compilacao/migrations/0030_auto_20151203_1117.py similarity index 100% rename from compilacao/migrations/0030_auto_20151203_1117.py rename to sapl/compilacao/migrations/0030_auto_20151203_1117.py diff --git a/compilacao/migrations/0031_merge.py b/sapl/compilacao/migrations/0031_merge.py similarity index 100% rename from compilacao/migrations/0031_merge.py rename to sapl/compilacao/migrations/0031_merge.py diff --git a/compilacao/migrations/0032_auto_20151213_1538.py b/sapl/compilacao/migrations/0032_auto_20151213_1538.py similarity index 100% rename from compilacao/migrations/0032_auto_20151213_1538.py rename to sapl/compilacao/migrations/0032_auto_20151213_1538.py diff --git a/compilacao/migrations/0033_auto_20151226_1320.py b/sapl/compilacao/migrations/0033_auto_20151226_1320.py similarity index 100% rename from compilacao/migrations/0033_auto_20151226_1320.py rename to sapl/compilacao/migrations/0033_auto_20151226_1320.py diff --git a/compilacao/migrations/0034_auto_20151226_1321.py b/sapl/compilacao/migrations/0034_auto_20151226_1321.py similarity index 100% rename from compilacao/migrations/0034_auto_20151226_1321.py rename to sapl/compilacao/migrations/0034_auto_20151226_1321.py diff --git a/compilacao/migrations/0035_auto_20151226_1349.py b/sapl/compilacao/migrations/0035_auto_20151226_1349.py similarity index 100% rename from compilacao/migrations/0035_auto_20151226_1349.py rename to sapl/compilacao/migrations/0035_auto_20151226_1349.py diff --git a/compilacao/migrations/0036_auto_20151226_1411.py b/sapl/compilacao/migrations/0036_auto_20151226_1411.py similarity index 100% rename from compilacao/migrations/0036_auto_20151226_1411.py rename to sapl/compilacao/migrations/0036_auto_20151226_1411.py diff --git a/compilacao/migrations/0037_auto_20151226_1414.py b/sapl/compilacao/migrations/0037_auto_20151226_1414.py similarity index 100% rename from compilacao/migrations/0037_auto_20151226_1414.py rename to sapl/compilacao/migrations/0037_auto_20151226_1414.py diff --git a/compilacao/migrations/0038_tipotextoarticulado_model.py b/sapl/compilacao/migrations/0038_tipotextoarticulado_model.py similarity index 100% rename from compilacao/migrations/0038_tipotextoarticulado_model.py rename to sapl/compilacao/migrations/0038_tipotextoarticulado_model.py diff --git a/compilacao/migrations/0039_auto_20151226_1433.py b/sapl/compilacao/migrations/0039_auto_20151226_1433.py similarity index 100% rename from compilacao/migrations/0039_auto_20151226_1433.py rename to sapl/compilacao/migrations/0039_auto_20151226_1433.py diff --git a/compilacao/migrations/0040_auto_20160106_1956.py b/sapl/compilacao/migrations/0040_auto_20160106_1956.py similarity index 100% rename from compilacao/migrations/0040_auto_20160106_1956.py rename to sapl/compilacao/migrations/0040_auto_20160106_1956.py diff --git a/compilacao/migrations/0041_auto_20160109_1928.py b/sapl/compilacao/migrations/0041_auto_20160109_1928.py similarity index 100% rename from compilacao/migrations/0041_auto_20160109_1928.py rename to sapl/compilacao/migrations/0041_auto_20160109_1928.py diff --git a/compilacao/migrations/0042_auto_20160110_1620.py b/sapl/compilacao/migrations/0042_auto_20160110_1620.py similarity index 100% rename from compilacao/migrations/0042_auto_20160110_1620.py rename to sapl/compilacao/migrations/0042_auto_20160110_1620.py diff --git a/compilacao/migrations/0043_auto_20160110_1733.py b/sapl/compilacao/migrations/0043_auto_20160110_1733.py similarity index 100% rename from compilacao/migrations/0043_auto_20160110_1733.py rename to sapl/compilacao/migrations/0043_auto_20160110_1733.py diff --git a/compilacao/migrations/0044_auto_20160307_0918.py b/sapl/compilacao/migrations/0044_auto_20160307_0918.py similarity index 100% rename from compilacao/migrations/0044_auto_20160307_0918.py rename to sapl/compilacao/migrations/0044_auto_20160307_0918.py diff --git a/compilacao/migrations/0045_auto_20160311_1117.py b/sapl/compilacao/migrations/0045_auto_20160311_1117.py similarity index 100% rename from compilacao/migrations/0045_auto_20160311_1117.py rename to sapl/compilacao/migrations/0045_auto_20160311_1117.py diff --git a/compilacao/migrations/0045_auto_20160404_1411.py b/sapl/compilacao/migrations/0045_auto_20160404_1411.py similarity index 100% rename from compilacao/migrations/0045_auto_20160404_1411.py rename to sapl/compilacao/migrations/0045_auto_20160404_1411.py diff --git a/compilacao/migrations/0046_auto_20160319_1542.py b/sapl/compilacao/migrations/0046_auto_20160319_1542.py similarity index 100% rename from compilacao/migrations/0046_auto_20160319_1542.py rename to sapl/compilacao/migrations/0046_auto_20160319_1542.py diff --git a/compilacao/migrations/0047_auto_20160330_0027.py b/sapl/compilacao/migrations/0047_auto_20160330_0027.py similarity index 100% rename from compilacao/migrations/0047_auto_20160330_0027.py rename to sapl/compilacao/migrations/0047_auto_20160330_0027.py diff --git a/compilacao/migrations/0048_auto_20160404_2309.py b/sapl/compilacao/migrations/0048_auto_20160404_2309.py similarity index 100% rename from compilacao/migrations/0048_auto_20160404_2309.py rename to sapl/compilacao/migrations/0048_auto_20160404_2309.py diff --git a/compilacao/migrations/0049_merge.py b/sapl/compilacao/migrations/0049_merge.py similarity index 100% rename from compilacao/migrations/0049_merge.py rename to sapl/compilacao/migrations/0049_merge.py diff --git a/compilacao/migrations/0050_auto_20160503_0926.py b/sapl/compilacao/migrations/0050_auto_20160503_0926.py similarity index 100% rename from compilacao/migrations/0050_auto_20160503_0926.py rename to sapl/compilacao/migrations/0050_auto_20160503_0926.py diff --git a/compilacao/__init__.py b/sapl/compilacao/migrations/__init__.py similarity index 100% rename from compilacao/__init__.py rename to sapl/compilacao/migrations/__init__.py diff --git a/compilacao/models.py b/sapl/compilacao/models.py similarity index 98% rename from compilacao/models.py rename to sapl/compilacao/models.py index bbca7a92b..fbc282610 100644 --- a/compilacao/models.py +++ b/sapl/compilacao/models.py @@ -6,9 +6,8 @@ from django.db.models.aggregates import Max from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ -from compilacao.utils import int_to_letter, int_to_roman -from sapl import utils -from sapl.utils import get_user_model +from sapl.compilacao.utils import int_to_letter, int_to_roman +from sapl.utils import YES_NO_CHOICES, get_settings_auth_user_model class TimestampedMixin(models.Model): @@ -79,7 +78,7 @@ class TipoTextoArticulado(models.Model): participacao_social = models.NullBooleanField( default=False, blank=True, null=True, - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, verbose_name=_('Participação Social')) class Meta: @@ -294,13 +293,13 @@ class TipoDispositivo(BaseModel): max_length=100, verbose_name=_('Sufixo html da nota automática')) contagem_continua = models.BooleanField( - choices=utils.YES_NO_CHOICES, verbose_name=_('Contagem contínua')) + choices=YES_NO_CHOICES, verbose_name=_('Contagem contínua')) dispositivo_de_articulacao = models.BooleanField( - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, default=False, verbose_name=_('Dispositivo de Articulação (Sem Texto)')) dispositivo_de_alteracao = models.BooleanField( - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, default=False, verbose_name=_('Dispositivo de Alteração')) formato_variacao0 = models.CharField( @@ -394,7 +393,7 @@ class PerfilEstruturalTextoArticulado(BaseModel): nome = models.CharField(max_length=50, verbose_name=_('Nome')) padrao = models.BooleanField( default=False, - choices=utils.YES_NO_CHOICES, verbose_name=_('Padrão')) + choices=YES_NO_CHOICES, verbose_name=_('Padrão')) class Meta: verbose_name = _('Perfil Estrutural de Texto Articulado') @@ -414,11 +413,11 @@ class TipoDispositivoRelationship(BaseModel): perfil = models.ForeignKey(PerfilEstruturalTextoArticulado) filho_de_insercao_automatica = models.BooleanField( default=False, - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, verbose_name=_('Filho de Inserção Automática')) permitir_variacao = models.BooleanField( default=True, - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, verbose_name=_('Permitir Variação Numérica')) quantidade_permitida = models.IntegerField( @@ -577,12 +576,12 @@ class Dispositivo(BaseModel, TimestampedMixin): inconstitucionalidade = models.BooleanField( default=False, - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, verbose_name=_('Declarado Inconstitucional')) # Relevant attribute only in altering norms visibilidade = models.BooleanField( default=False, - choices=utils.YES_NO_CHOICES, + choices=YES_NO_CHOICES, verbose_name=_('Visibilidade no Texto Articulado Publicado')) tipo_dispositivo = models.ForeignKey( @@ -1293,7 +1292,8 @@ class Nota(TimestampedMixin): verbose_name=_('Dispositivo da Nota'), related_name='dispositivo_nota_set') - owner = models.ForeignKey(get_user_model(), verbose_name=_('Dono da Nota')) + owner = models.ForeignKey( + get_settings_auth_user_model(), verbose_name=_('Dono da Nota')) publicidade = models.PositiveSmallIntegerField( choices=NOTAS_PUBLICIDADE_CHOICES, verbose_name=_('Nível de Publicidade')) diff --git a/compilacao/migrations/__init__.py b/sapl/compilacao/templatetags/__init__.py similarity index 100% rename from compilacao/migrations/__init__.py rename to sapl/compilacao/templatetags/__init__.py diff --git a/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py similarity index 98% rename from compilacao/templatetags/compilacao_filters.py rename to sapl/compilacao/templatetags/compilacao_filters.py index b43d28baf..3fd024a77 100644 --- a/compilacao/templatetags/compilacao_filters.py +++ b/sapl/compilacao/templatetags/compilacao_filters.py @@ -5,7 +5,7 @@ from django.db.models import Q from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ -from compilacao.models import Dispositivo +from sapl.compilacao.models import Dispositivo register = template.Library() @@ -247,7 +247,7 @@ def nomenclatura_heranca(d, ignore_ultimo=0, ignore_primeiro=0): @register.filter def urldetail_content_type(obj): return '%s:%s_detail' % ( - obj.content_type.app_label, obj.content_type.model) + obj.content_object._meta.app_config.name, obj.content_type.model) @register.filter diff --git a/compilacao/urls.py b/sapl/compilacao/urls.py similarity index 96% rename from compilacao/urls.py rename to sapl/compilacao/urls.py index 199d02f58..f5466e747 100644 --- a/compilacao/urls.py +++ b/sapl/compilacao/urls.py @@ -1,8 +1,8 @@ from django.conf.urls import include, url -from compilacao import views -from compilacao.views import (TipoNotaCrud, TipoPublicacaoCrud, TipoVideCrud, - VeiculoPublicacaoCrud) +from sapl.compilacao import views +from sapl.compilacao.views import (TipoNotaCrud, TipoPublicacaoCrud, + TipoVideCrud, VeiculoPublicacaoCrud) from .apps import AppConfig diff --git a/compilacao/utils.py b/sapl/compilacao/utils.py similarity index 100% rename from compilacao/utils.py rename to sapl/compilacao/utils.py diff --git a/compilacao/views.py b/sapl/compilacao/views.py similarity index 94% rename from compilacao/views.py rename to sapl/compilacao/views.py index 6ff059075..339d6a5de 100644 --- a/compilacao/views.py +++ b/sapl/compilacao/views.py @@ -1,6 +1,6 @@ -import sys from collections import OrderedDict from datetime import datetime, timedelta +import sys from braces.views import FormMessagesMixin from django import forms @@ -22,20 +22,22 @@ from django.views.generic.edit import (CreateView, DeleteView, FormView, UpdateView) from django.views.generic.list import ListView -from compilacao.forms import (DispositivoDefinidorVigenciaForm, - DispositivoEdicaoAlteracaoForm, - DispositivoEdicaoBasicaForm, - DispositivoEdicaoVigenciaForm, - DispositivoSearchModalForm, NotaForm, - PublicacaoForm, TaForm, TextNotificacoesForm, - TipoTaForm, VideForm) -from compilacao.models import (Dispositivo, Nota, - PerfilEstruturalTextoArticulado, Publicacao, - TextoArticulado, TipoDispositivo, TipoNota, - TipoPublicacao, TipoTextoArticulado, TipoVide, - VeiculoPublicacao, Vide) -from compilacao.utils import DISPOSITIVO_SELECT_RELATED -from crud.base import Crud, CrudListView, make_pagination +from sapl.compilacao.forms import (DispositivoDefinidorVigenciaForm, + DispositivoEdicaoAlteracaoForm, + DispositivoEdicaoBasicaForm, + DispositivoEdicaoVigenciaForm, + DispositivoSearchModalForm, NotaForm, + PublicacaoForm, TaForm, + TextNotificacoesForm, TipoTaForm, VideForm) +from sapl.compilacao.models import (Dispositivo, Nota, + PerfilEstruturalTextoArticulado, + Publicacao, TextoArticulado, + TipoDispositivo, TipoNota, TipoPublicacao, + TipoTextoArticulado, TipoVide, + VeiculoPublicacao, Vide) +from sapl.compilacao.utils import DISPOSITIVO_SELECT_RELATED +from sapl.crud.base import Crud, CrudListView, make_pagination + TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota') TipoVideCrud = Crud.build(TipoVide, 'tipo_vide') @@ -95,7 +97,7 @@ class IntegracaoTaView(TemplateView): ta.save() - return redirect(to=reverse_lazy('compilacao:ta_text', + return redirect(to=reverse_lazy('sapl.compilacao:ta_text', kwargs={'ta_id': ta.pk})) class Meta: @@ -151,7 +153,7 @@ class TipoTaListView(ListView): @property def create_url(self): - return reverse_lazy('compilacao:tipo_ta_create') + return reverse_lazy('sapl.compilacao:tipo_ta_create') class TipoTaCreateView(FormMessagesMixin, CreateView): @@ -171,12 +173,12 @@ class TipoTaCreateView(FormMessagesMixin, CreateView): return self.render_to_response(self.get_context_data(form=form)) def get_success_url(self): - return reverse_lazy('compilacao:tipo_ta_detail', + return reverse_lazy('sapl.compilacao:tipo_ta_detail', kwargs={'pk': self.object.id}) @property def cancel_url(self): - return reverse_lazy('compilacao:tipo_ta_list') + return reverse_lazy('sapl.compilacao:tipo_ta_list') class TipoTaDetailView(CompMixin, DetailView): @@ -197,12 +199,12 @@ class TipoTaUpdateView(CompMixin, UpdateView): return self.render_to_response(self.get_context_data(form=form)) def get_success_url(self): - return reverse_lazy('compilacao:tipo_ta_detail', + return reverse_lazy('sapl.compilacao:tipo_ta_detail', kwargs={'pk': self.kwargs['pk']}) @property def cancel_url(self): - return reverse_lazy('compilacao:tipo_ta_detail', + return reverse_lazy('sapl.compilacao:tipo_ta_detail', kwargs={'pk': self.kwargs['pk']}) @@ -212,11 +214,11 @@ class TipoTaDeleteView(CompMixin, DeleteView): @property def detail_url(self): - return reverse_lazy('compilacao:tipo_ta_detail', + return reverse_lazy('sapl.compilacao:tipo_ta_detail', kwargs={'pk': self.kwargs['pk']}) def get_success_url(self): - return reverse_lazy('compilacao:tipo_ta_list') + return reverse_lazy('sapl.compilacao:tipo_ta_list') class TaListView(ListView): @@ -230,7 +232,7 @@ class TaListView(ListView): @property def create_url(self): - return reverse_lazy('compilacao:ta_create') + return reverse_lazy('sapl.compilacao:ta_create') def get_context_data(self, **kwargs): context = super(TaListView, self).get_context_data(**kwargs) @@ -264,12 +266,12 @@ class TaCreateView(FormMessagesMixin, CreateView): form_invalid_message = _('O registro não foi criado.') def get_success_url(self): - return reverse_lazy('compilacao:ta_detail', + return reverse_lazy('sapl.compilacao:ta_detail', kwargs={'pk': self.object.id}) @property def cancel_url(self): - return reverse_lazy('compilacao:ta_list') + return reverse_lazy('sapl.compilacao:ta_list') class TaUpdateView(CompMixin, UpdateView): @@ -286,12 +288,12 @@ class TaUpdateView(CompMixin, UpdateView): return self.render_to_response(self.get_context_data(form=form)) def get_success_url(self): - return reverse_lazy('compilacao:ta_detail', + return reverse_lazy('sapl.compilacao:ta_detail', kwargs={'pk': self.kwargs['pk']}) @property def cancel_url(self): - return reverse_lazy('compilacao:ta_detail', + return reverse_lazy('sapl.compilacao:ta_detail', kwargs={'pk': self.kwargs['pk']}) @@ -301,18 +303,18 @@ class TaDeleteView(CompMixin, DeleteView): @property def detail_url(self): - return reverse_lazy('compilacao:ta_detail', + return reverse_lazy('sapl.compilacao:ta_detail', kwargs={'pk': self.kwargs['pk']}) def get_success_url(self): - return reverse_lazy('compilacao:ta_list') + return reverse_lazy('sapl.compilacao:ta_list') class DispositivoSuccessUrlMixin: def get_success_url(self): return reverse_lazy( - 'compilacao:dispositivo', kwargs={ + 'sapl.compilacao:dispositivo', kwargs={ 'ta_id': self.kwargs[ 'ta_id'], 'dispositivo_id': self.kwargs[ @@ -486,7 +488,7 @@ class PublicacaoListView(ListView): @property def create_url(self): return reverse_lazy( - 'compilacao:ta_pub_create', + 'sapl.compilacao:ta_pub_create', kwargs={'ta_id': self.kwargs['ta_id']}) def get_queryset(self): @@ -508,7 +510,7 @@ class PublicacaoCreateView(FormMessagesMixin, CreateView): def get_success_url(self): return reverse_lazy( - 'compilacao:ta_pub_detail', + 'sapl.compilacao:ta_pub_detail', kwargs={ 'pk': self.object.id, 'ta_id': self.kwargs['ta_id']}) @@ -516,7 +518,7 @@ class PublicacaoCreateView(FormMessagesMixin, CreateView): @property def cancel_url(self): return reverse_lazy( - 'compilacao:ta_pub_list', + 'sapl.compilacao:ta_pub_list', kwargs={'ta_id': self.kwargs['ta_id']}) def get_initial(self): @@ -541,7 +543,7 @@ class PublicacaoUpdateView(CompMixin, UpdateView): return self.render_to_response(self.get_context_data(form=form)) def get_success_url(self): - return reverse_lazy('compilacao:ta_pub_detail', + return reverse_lazy('sapl.compilacao:ta_pub_detail', kwargs={ 'pk': self.object.id, 'ta_id': self.kwargs['ta_id']}) @@ -557,13 +559,13 @@ class PublicacaoDeleteView(CompMixin, DeleteView): @property def detail_url(self): - return reverse_lazy('compilacao:ta_pub_detail', + return reverse_lazy('sapl.compilacao:ta_pub_detail', kwargs={ 'pk': self.object.id, 'ta_id': self.kwargs['ta_id']}) def get_success_url(self): - return reverse_lazy('compilacao:ta_pub_list', + return reverse_lazy('sapl.compilacao:ta_pub_list', kwargs={'ta_id': self.kwargs['ta_id']}) @@ -2140,6 +2142,20 @@ class DispositivoSearchFragmentFormView(ListView): r = [] + """ + ao integrar um model ao app de compilação, se este model possuir + + texto_articulado = GenericRelation( + TextoArticulado, related_query_name='texto_articulado') + + será uma integração mais eficiente para as buscas de Dispositivos + """ + if hasattr(model_class, 'texto_articulado'): + q = q & Q(**{ + 'ta__texto_articulado__' + column_field: tipo_model.pk + }) + result = result.filter(q)[:n] + for d in result: if not d.ta.content_object or\ not hasattr(d.ta.content_object, column_field): @@ -2173,16 +2189,16 @@ class DispositivoEdicaoBasicaView(FormMessagesMixin, UpdateView): @property def cancel_url(self): return reverse_lazy( - 'compilacao:ta_text_edit', + 'sapl.compilacao:ta_text_edit', kwargs={'ta_id': self.kwargs['ta_id']}) + '#' + str(self.object.pk) def get_success_url(self): return reverse_lazy( - 'compilacao:dispositivo_edit', + 'sapl.compilacao:dispositivo_edit', kwargs={'ta_id': self.kwargs['ta_id'], 'pk': self.kwargs['pk']}) def get_url_this_view(self): - return 'compilacao:dispositivo_edit' + return 'sapl.compilacao:dispositivo_edit' def run_actions(self, request): if 'action' in request.GET and\ @@ -2245,15 +2261,15 @@ class DispositivoEdicaoVigenciaView(FormMessagesMixin, UpdateView): @property def cancel_url(self): return reverse_lazy( - 'compilacao:ta_text_edit', + 'sapl.compilacao:ta_text_edit', kwargs={'ta_id': self.kwargs['ta_id']}) + '#' + str(self.object.pk) def get_url_this_view(self): - return 'compilacao:dispositivo_edit_vigencia' + return 'sapl.compilacao:dispositivo_edit_vigencia' def get_success_url(self): return reverse_lazy( - 'compilacao:dispositivo_edit_vigencia', + 'sapl.compilacao:dispositivo_edit_vigencia', kwargs={'ta_id': self.kwargs['ta_id'], 'pk': self.kwargs['pk']}) @@ -2275,15 +2291,15 @@ class DispositivoDefinidorVigenciaView(FormMessagesMixin, FormView): @property def cancel_url(self): return reverse_lazy( - 'compilacao:ta_text_edit', + 'sapl.compilacao:ta_text_edit', kwargs={'ta_id': self.kwargs['ta_id']}) + '#' + str(self.object.pk) def get_url_this_view(self): - return 'compilacao:dispositivo_edit_definidor_vigencia' + return 'sapl.compilacao:dispositivo_edit_definidor_vigencia' def get_success_url(self): return reverse_lazy( - 'compilacao:dispositivo_edit_definidor_vigencia', + 'sapl.compilacao:dispositivo_edit_definidor_vigencia', kwargs={'ta_id': self.kwargs['ta_id'], 'pk': self.kwargs['pk']}) def get(self, request, *args, **kwargs): @@ -2325,15 +2341,15 @@ class DispositivoEdicaoAlteracaoView(FormMessagesMixin, UpdateView): @property def cancel_url(self): return reverse_lazy( - 'compilacao:ta_text_edit', + 'sapl.compilacao:ta_text_edit', kwargs={'ta_id': self.kwargs['ta_id']}) + '#' + str(self.object.pk) def get_url_this_view(self): - return 'compilacao:dispositivo_edit_alteracao' + return 'sapl.compilacao:dispositivo_edit_alteracao' def get_success_url(self): return reverse_lazy( - 'compilacao:dispositivo_edit_alteracao', + 'sapl.compilacao:dispositivo_edit_alteracao', kwargs={'ta_id': self.kwargs['ta_id'], 'pk': self.kwargs['pk']}) def post(self, request, *args, **kwargs): @@ -2364,7 +2380,7 @@ class TextNotificacoesView(ListView, CompMixin, FormView): return super(TextNotificacoesView, self).get_context_data(**kwargs) def get_success_url(self): - return reverse_lazy('compilacao:ta_text_notificacoes', + return reverse_lazy('sapl.compilacao:ta_text_notificacoes', kwargs=self.kwargs) def get_initial(self): @@ -2411,39 +2427,43 @@ class TextNotificacoesView(ListView, CompMixin, FormView): def success(r): type_notificacao = 'success' - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.inconstitucionalidade, _('Declarado Inconstitucional.')) - padd(r, type_notificacao, 'compilacao:ta_text_edit', + padd(r, type_notificacao, 'sapl.compilacao:ta_text_edit', r.ta_publicado and r.dispositivo_atualizador, _('Dispositivo alterado em %s' % r.ta_publicado), {'ta_id': r.ta_publicado_id}, r.dispositivo_atualizador_id) def info(r): type_notificacao = 'info' - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.publicacao and r.dispositivo_vigencia and r.publicacao.data != r.dispositivo_vigencia.inicio_vigencia, _('Data da publicação associada ao Dispositivo difere da data' ' de inicio de vigência do Dispositivo de vigência.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.publicacao and r.publicacao.data != r.inicio_vigencia, _('Data da publicação associada ao Dispositivo difere ' 'da data de inicio de vigência.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit', + padd(r, type_notificacao, 'sapl.compilacao:dispositivo_edit', r.rotulo != r.rotulo_padrao(local_insert=1), _('Rótulo Diferente do Padrão')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit', + padd(r, type_notificacao, 'sapl.compilacao:dispositivo_edit', r.texto_atualizador and r.texto_atualizador != r.texto, _('Texto do Dispositivo para o Documento ' 'está diferente do texto para o Documento Alterador.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', r.texto_atualizador and r.texto_atualizador == r.texto, _('Texto do Dispositivo no Documento Alterador ' 'está igual ao Texto no Documento Original. ' @@ -2452,20 +2472,22 @@ class TextNotificacoesView(ListView, CompMixin, FormView): def warning(r): type_notificacao = 'warning' - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.dispositivo_vigencia and r.inicio_vigencia != r.dispositivo_vigencia.inicio_vigencia, _('Data de início de Vigência difere da data início de ' 'Vigência do Dispositivo de Vigência')) - padd(r, type_notificacao, 'compilacao:ta_text', + padd(r, type_notificacao, 'sapl.compilacao:ta_text', r.inconstitucionalidade and not r.notas.exists(), _('Dispositivo está definido como inconstitucional. É ' 'aconcelhavel inserir uma Nota informando esta condição.'), kwargs={'ta_id': r.ta_id}, to_position=r.pk) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.inconstitucionalidade and not ( r.inicio_vigencia == r.fim_vigencia and r.fim_vigencia == r.inicio_eficacia and @@ -2474,62 +2496,73 @@ class TextNotificacoesView(ListView, CompMixin, FormView): 'existe diferença entre as datas início e fim de ' 'vigência e eficácia.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.publicacao and r.ta_publicado and r.ta_publicado != r.publicacao.ta, _('A Publicação associada a este Dispositivo não é ' 'uma publicação do Texto Articulado Alterador.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', not r.publicacao, _('Dispositivo sem registro de publicação.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.texto and r.tipo_dispositivo.dispositivo_de_articulacao, _('Dispositivos de Articulação não ' 'deveriam armazenar texto.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', not r.texto and not r.tipo_dispositivo.dispositivo_de_articulacao, _('Dispositivo está sem texto.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', r.texto_atualizador and not r.ta_publicado, _('Existe Texto Atualizador, porém este Dispositivo não ' 'está associado a nenhum Documento Atualizador.')) def danger(r): type_notificacao = 'danger' - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', not r.dispositivo_vigencia, _('Dispositivo sem definição de Dispositivo de Vigência.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_vigencia', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_vigencia', r.inconstitucionalidade and r.inicio_vigencia != r.fim_vigencia, _('Dispositivo está definido como inconstitucional porém ' 'existe período de vigência.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', r.ta_publicado and not r.dispositivo_atualizador, _('Dispositivo está associado a um Texto Articulado ' 'Atualizador mas, a nenhum Dispositivo Atualizador.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', not r.dispositivo_atualizador and r.dispositivo_substituido, _('Dispositivo está substituindo outro mas não foi informado ' 'o Dispositivo Atualizador.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', r.dispositivo_substituido and r.dispositivo_substituido.tipo_dispositivo != r.tipo_dispositivo, _('Dispositivo está substituindo um Dispositivo ' 'de outro tipo.')) - padd(r, type_notificacao, 'compilacao:dispositivo_edit_alteracao', + padd(r, type_notificacao, + 'sapl.compilacao:dispositivo_edit_alteracao', r.dispositivo_substituido and r.dispositivo_substituido.ta != r.ta, _('Dispositivo está substituindo um Dispositivo de outro ' diff --git a/sapl/context_processors.py b/sapl/context_processors.py index bba385b12..cc7daca57 100644 --- a/sapl/context_processors.py +++ b/sapl/context_processors.py @@ -1,6 +1,6 @@ -from base.views import get_casalegislativa +from sapl.base.views import get_casalegislativa def parliament_info(request): diff --git a/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py similarity index 100% rename from crispy_layout_mixin.py rename to sapl/crispy_layout_mixin.py diff --git a/compilacao/templatetags/__init__.py b/sapl/crud/__init__.py similarity index 100% rename from compilacao/templatetags/__init__.py rename to sapl/crud/__init__.py diff --git a/crud/base.py b/sapl/crud/base.py similarity index 98% rename from crud/base.py rename to sapl/crud/base.py index cfe2c370d..289bd21e1 100644 --- a/crud/base.py +++ b/sapl/crud/base.py @@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic import (CreateView, DeleteView, DetailView, ListView, UpdateView) -from crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display +from sapl.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display LIST, CREATE, DETAIL, UPDATE, DELETE = \ 'list', 'create', 'detail', 'update', 'delete' @@ -63,7 +63,7 @@ class CrudBaseMixin(CrispyLayoutFormMixin): return '%s_%s' % (cls.model._meta.model_name, suffix) def resolve_url(self, suffix, args=None): - namespace = self.model._meta.app_label + namespace = self.model._meta.app_config.name return reverse('%s:%s' % (namespace, self.url_name(suffix)), args=args) diff --git a/crud/masterdetail.py b/sapl/crud/masterdetail.py similarity index 100% rename from crud/masterdetail.py rename to sapl/crud/masterdetail.py diff --git a/crud/__init__.py b/sapl/crud/tests/__init__.py similarity index 100% rename from crud/__init__.py rename to sapl/crud/tests/__init__.py diff --git a/crud/tests/settings.py b/sapl/crud/tests/settings.py similarity index 100% rename from crud/tests/settings.py rename to sapl/crud/tests/settings.py diff --git a/crud/tests/stub_app/layouts.yaml b/sapl/crud/tests/stub_app/layouts.yaml similarity index 100% rename from crud/tests/stub_app/layouts.yaml rename to sapl/crud/tests/stub_app/layouts.yaml diff --git a/crud/tests/stub_app/models.py b/sapl/crud/tests/stub_app/models.py similarity index 100% rename from crud/tests/stub_app/models.py rename to sapl/crud/tests/stub_app/models.py diff --git a/crud/tests/stub_app/templates/base.html b/sapl/crud/tests/stub_app/templates/base.html similarity index 100% rename from crud/tests/stub_app/templates/base.html rename to sapl/crud/tests/stub_app/templates/base.html diff --git a/crud/tests/stub_app/urls.py b/sapl/crud/tests/stub_app/urls.py similarity index 100% rename from crud/tests/stub_app/urls.py rename to sapl/crud/tests/stub_app/urls.py diff --git a/crud/tests/stub_app/views.py b/sapl/crud/tests/stub_app/views.py similarity index 72% rename from crud/tests/stub_app/views.py rename to sapl/crud/tests/stub_app/views.py index cd63fb7f1..81c6b834d 100644 --- a/crud/tests/stub_app/views.py +++ b/sapl/crud/tests/stub_app/views.py @@ -1,5 +1,5 @@ -from crud.base import Crud, CrudListView -from crud.masterdetail import MasterDetailCrud +from sapl.crud.base import Crud, CrudListView +from sapl.crud.masterdetail import MasterDetailCrud from .models import City, Country diff --git a/crud/tests/test_base.py b/sapl/crud/tests/test_base.py similarity index 95% rename from crud/tests/test_base.py rename to sapl/crud/tests/test_base.py index 0982b3d25..8e1d10965 100644 --- a/crud/tests/test_base.py +++ b/sapl/crud/tests/test_base.py @@ -2,11 +2,10 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from crud.base import (CrispyLayoutFormMixin, CrudListView, from_to, - get_field_display, make_pagination) - -from .stub_app.models import Continent, Country -from .stub_app.views import CountryCrud +from sapl.crud.base import (CrispyLayoutFormMixin, CrudListView, from_to, + get_field_display, make_pagination) +from sapl.crud.tests.stub_app.models import Continent, Country +from sapl.crud.tests.stub_app.views import CountryCrud pytestmark = pytest.mark.django_db @@ -140,12 +139,13 @@ def test_layout_detail_fieldsets(): def test_reverse(): - assert '/country/' == reverse('stub_app:country_list') - assert '/country/create' == reverse('stub_app:country_create') - assert '/country/2' == reverse('stub_app:country_detail', args=(2,)) - assert '/country/2/edit' == reverse('stub_app:country_update', args=(2,)) + assert '/country/' == reverse('sapl.stub_app:country_list') + assert '/country/create' == reverse('sapl.stub_app:country_create') + assert '/country/2' == reverse('sapl.stub_app:country_detail', args=(2,)) + assert '/country/2/edit' == reverse( + 'sapl.stub_app:country_update', args=(2,)) assert '/country/2/delete' == reverse( - 'stub_app:country_delete', args=(2,)) + 'sapl.stub_app:country_delete', args=(2,)) def assert_h1(res, title): diff --git a/crud/tests/test_masterdetail.py b/sapl/crud/tests/test_masterdetail.py similarity index 100% rename from crud/tests/test_masterdetail.py rename to sapl/crud/tests/test_masterdetail.py diff --git a/crud/urls.py b/sapl/crud/urls.py similarity index 100% rename from crud/urls.py rename to sapl/crud/urls.py diff --git a/legacy/Docs/verificação verbose names.txt b/sapl/legacy/Docs/verificação verbose names.txt similarity index 100% rename from legacy/Docs/verificação verbose names.txt rename to sapl/legacy/Docs/verificação verbose names.txt diff --git a/crud/tests/__init__.py b/sapl/legacy/__init__.py similarity index 100% rename from crud/tests/__init__.py rename to sapl/legacy/__init__.py diff --git a/legacy/admin.py b/sapl/legacy/admin.py similarity index 100% rename from legacy/admin.py rename to sapl/legacy/admin.py diff --git a/legacy/migration.py b/sapl/legacy/migration.py similarity index 97% rename from legacy/migration.py rename to sapl/legacy/migration.py index eedb39213..bcf258129 100644 --- a/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -11,16 +11,15 @@ from django.db.models.base import ModelBase from model_mommy import mommy from model_mommy.mommy import foreign_key_required, make -from base.models import ProblemaMigracao -from comissoes.models import Composicao, Participacao -from materia.models import StatusTramitacao, Tramitacao -from norma.models import AssuntoNormaRelationship, NormaJuridica -from parlamentares.models import Parlamentar -from protocoloadm.models import StatusTramitacaoAdministrativo -from sessao.models import OrdemDia, SessaoPlenaria +from sapl.base.models import ProblemaMigracao +from sapl.comissoes.models import Composicao, Participacao +from sapl.materia.models import StatusTramitacao, Tramitacao +from sapl.norma.models import AssuntoNormaRelationship, NormaJuridica +from sapl.parlamentares.models import Parlamentar +from sapl.protocoloadm.models import StatusTramitacaoAdministrativo +from sapl.sessao.models import OrdemDia, SessaoPlenaria # BASE ###################################################################### - # apps to be migrated, in app dependency order (very important) appconfs = [apps.get_app_config(n) for n in [ 'parlamentares', @@ -234,6 +233,7 @@ def get_fields_dict(model): class DataMigrator: + def __init__(self): self.field_renames, self.model_renames = get_renames() self.data_mudada = {} diff --git a/legacy/migrations/0001_initial.py b/sapl/legacy/migrations/0001_initial.py similarity index 100% rename from legacy/migrations/0001_initial.py rename to sapl/legacy/migrations/0001_initial.py diff --git a/legacy/__init__.py b/sapl/legacy/migrations/__init__.py similarity index 100% rename from legacy/__init__.py rename to sapl/legacy/migrations/__init__.py diff --git a/legacy/models.py b/sapl/legacy/models.py similarity index 100% rename from legacy/models.py rename to sapl/legacy/models.py diff --git a/legacy/router.py b/sapl/legacy/router.py similarity index 100% rename from legacy/router.py rename to sapl/legacy/router.py diff --git a/legacy/run_legacy_tests.sh b/sapl/legacy/run_legacy_tests.sh similarity index 100% rename from legacy/run_legacy_tests.sh rename to sapl/legacy/run_legacy_tests.sh diff --git a/legacy/migrations/__init__.py b/sapl/legacy/scripts/__init__.py similarity index 100% rename from legacy/migrations/__init__.py rename to sapl/legacy/scripts/__init__.py diff --git a/legacy/scripts/old_names_adjustments.yaml b/sapl/legacy/scripts/old_names_adjustments.yaml similarity index 100% rename from legacy/scripts/old_names_adjustments.yaml rename to sapl/legacy/scripts/old_names_adjustments.yaml diff --git a/legacy/scripts/original_forms/Afastamento.html b/sapl/legacy/scripts/original_forms/Afastamento.html similarity index 100% rename from legacy/scripts/original_forms/Afastamento.html rename to sapl/legacy/scripts/original_forms/Afastamento.html diff --git a/legacy/scripts/original_forms/Anexada.html b/sapl/legacy/scripts/original_forms/Anexada.html similarity index 100% rename from legacy/scripts/original_forms/Anexada.html rename to sapl/legacy/scripts/original_forms/Anexada.html diff --git a/legacy/scripts/original_forms/AssuntoNorma.html b/sapl/legacy/scripts/original_forms/AssuntoNorma.html similarity index 100% rename from legacy/scripts/original_forms/AssuntoNorma.html rename to sapl/legacy/scripts/original_forms/AssuntoNorma.html diff --git a/legacy/scripts/original_forms/Autor.html b/sapl/legacy/scripts/original_forms/Autor.html similarity index 100% rename from legacy/scripts/original_forms/Autor.html rename to sapl/legacy/scripts/original_forms/Autor.html diff --git a/legacy/scripts/original_forms/Autoria.html b/sapl/legacy/scripts/original_forms/Autoria.html similarity index 100% rename from legacy/scripts/original_forms/Autoria.html rename to sapl/legacy/scripts/original_forms/Autoria.html diff --git a/legacy/scripts/original_forms/Bancada.html b/sapl/legacy/scripts/original_forms/Bancada.html similarity index 100% rename from legacy/scripts/original_forms/Bancada.html rename to sapl/legacy/scripts/original_forms/Bancada.html diff --git a/legacy/scripts/original_forms/CasaLegislativa.html b/sapl/legacy/scripts/original_forms/CasaLegislativa.html similarity index 100% rename from legacy/scripts/original_forms/CasaLegislativa.html rename to sapl/legacy/scripts/original_forms/CasaLegislativa.html diff --git a/legacy/scripts/original_forms/Coligacao.html b/sapl/legacy/scripts/original_forms/Coligacao.html similarity index 100% rename from legacy/scripts/original_forms/Coligacao.html rename to sapl/legacy/scripts/original_forms/Coligacao.html diff --git a/legacy/scripts/original_forms/Comissao.html b/sapl/legacy/scripts/original_forms/Comissao.html similarity index 100% rename from legacy/scripts/original_forms/Comissao.html rename to sapl/legacy/scripts/original_forms/Comissao.html diff --git a/legacy/scripts/original_forms/ComposicaoComissao.html b/sapl/legacy/scripts/original_forms/ComposicaoComissao.html similarity index 100% rename from legacy/scripts/original_forms/ComposicaoComissao.html rename to sapl/legacy/scripts/original_forms/ComposicaoComissao.html diff --git a/legacy/scripts/original_forms/Dependente.html b/sapl/legacy/scripts/original_forms/Dependente.html similarity index 100% rename from legacy/scripts/original_forms/Dependente.html rename to sapl/legacy/scripts/original_forms/Dependente.html diff --git a/legacy/scripts/original_forms/DocumentoAcessorio.html b/sapl/legacy/scripts/original_forms/DocumentoAcessorio.html similarity index 100% rename from legacy/scripts/original_forms/DocumentoAcessorio.html rename to sapl/legacy/scripts/original_forms/DocumentoAcessorio.html diff --git a/legacy/scripts/original_forms/DocumentoAcessorioAdministrativo.html b/sapl/legacy/scripts/original_forms/DocumentoAcessorioAdministrativo.html similarity index 100% rename from legacy/scripts/original_forms/DocumentoAcessorioAdministrativo.html rename to sapl/legacy/scripts/original_forms/DocumentoAcessorioAdministrativo.html diff --git a/legacy/scripts/original_forms/DocumentoAdministrativo.html b/sapl/legacy/scripts/original_forms/DocumentoAdministrativo.html similarity index 100% rename from legacy/scripts/original_forms/DocumentoAdministrativo.html rename to sapl/legacy/scripts/original_forms/DocumentoAdministrativo.html diff --git a/legacy/scripts/original_forms/ExpedienteMateria.html b/sapl/legacy/scripts/original_forms/ExpedienteMateria.html similarity index 100% rename from legacy/scripts/original_forms/ExpedienteMateria.html rename to sapl/legacy/scripts/original_forms/ExpedienteMateria.html diff --git a/legacy/scripts/original_forms/Filiacao.html b/sapl/legacy/scripts/original_forms/Filiacao.html similarity index 100% rename from legacy/scripts/original_forms/Filiacao.html rename to sapl/legacy/scripts/original_forms/Filiacao.html diff --git a/legacy/scripts/original_forms/LegislacaoCitada.html b/sapl/legacy/scripts/original_forms/LegislacaoCitada.html similarity index 100% rename from legacy/scripts/original_forms/LegislacaoCitada.html rename to sapl/legacy/scripts/original_forms/LegislacaoCitada.html diff --git a/legacy/scripts/original_forms/Legislatura.html b/sapl/legacy/scripts/original_forms/Legislatura.html similarity index 100% rename from legacy/scripts/original_forms/Legislatura.html rename to sapl/legacy/scripts/original_forms/Legislatura.html diff --git a/legacy/scripts/original_forms/LexmlRegistroProvedor.html b/sapl/legacy/scripts/original_forms/LexmlRegistroProvedor.html similarity index 100% rename from legacy/scripts/original_forms/LexmlRegistroProvedor.html rename to sapl/legacy/scripts/original_forms/LexmlRegistroProvedor.html diff --git a/legacy/scripts/original_forms/LexmlRegistroPublicador.html b/sapl/legacy/scripts/original_forms/LexmlRegistroPublicador.html similarity index 100% rename from legacy/scripts/original_forms/LexmlRegistroPublicador.html rename to sapl/legacy/scripts/original_forms/LexmlRegistroPublicador.html diff --git a/legacy/scripts/original_forms/Mandato.html b/sapl/legacy/scripts/original_forms/Mandato.html similarity index 100% rename from legacy/scripts/original_forms/Mandato.html rename to sapl/legacy/scripts/original_forms/Mandato.html diff --git a/legacy/scripts/original_forms/MateriaLegislativa.html b/sapl/legacy/scripts/original_forms/MateriaLegislativa.html similarity index 100% rename from legacy/scripts/original_forms/MateriaLegislativa.html rename to sapl/legacy/scripts/original_forms/MateriaLegislativa.html diff --git a/legacy/scripts/original_forms/NormaJuridica.html b/sapl/legacy/scripts/original_forms/NormaJuridica.html similarity index 100% rename from legacy/scripts/original_forms/NormaJuridica.html rename to sapl/legacy/scripts/original_forms/NormaJuridica.html diff --git a/legacy/scripts/original_forms/Numeracao.html b/sapl/legacy/scripts/original_forms/Numeracao.html similarity index 100% rename from legacy/scripts/original_forms/Numeracao.html rename to sapl/legacy/scripts/original_forms/Numeracao.html diff --git a/legacy/scripts/original_forms/Oradores.html b/sapl/legacy/scripts/original_forms/Oradores.html similarity index 100% rename from legacy/scripts/original_forms/Oradores.html rename to sapl/legacy/scripts/original_forms/Oradores.html diff --git a/legacy/scripts/original_forms/OradoresExpediente.html b/sapl/legacy/scripts/original_forms/OradoresExpediente.html similarity index 100% rename from legacy/scripts/original_forms/OradoresExpediente.html rename to sapl/legacy/scripts/original_forms/OradoresExpediente.html diff --git a/legacy/scripts/original_forms/OrdemDia.html b/sapl/legacy/scripts/original_forms/OrdemDia.html similarity index 100% rename from legacy/scripts/original_forms/OrdemDia.html rename to sapl/legacy/scripts/original_forms/OrdemDia.html diff --git a/legacy/scripts/original_forms/Orgao.html b/sapl/legacy/scripts/original_forms/Orgao.html similarity index 100% rename from legacy/scripts/original_forms/Orgao.html rename to sapl/legacy/scripts/original_forms/Orgao.html diff --git a/legacy/scripts/original_forms/Origem.html b/sapl/legacy/scripts/original_forms/Origem.html similarity index 100% rename from legacy/scripts/original_forms/Origem.html rename to sapl/legacy/scripts/original_forms/Origem.html diff --git a/legacy/scripts/original_forms/PainelEletronico.html b/sapl/legacy/scripts/original_forms/PainelEletronico.html similarity index 100% rename from legacy/scripts/original_forms/PainelEletronico.html rename to sapl/legacy/scripts/original_forms/PainelEletronico.html diff --git a/legacy/scripts/original_forms/Parlamentar.html b/sapl/legacy/scripts/original_forms/Parlamentar.html similarity index 100% rename from legacy/scripts/original_forms/Parlamentar.html rename to sapl/legacy/scripts/original_forms/Parlamentar.html diff --git a/legacy/scripts/original_forms/Partido.html b/sapl/legacy/scripts/original_forms/Partido.html similarity index 100% rename from legacy/scripts/original_forms/Partido.html rename to sapl/legacy/scripts/original_forms/Partido.html diff --git a/legacy/scripts/original_forms/PeriodoCompComissao.html b/sapl/legacy/scripts/original_forms/PeriodoCompComissao.html similarity index 100% rename from legacy/scripts/original_forms/PeriodoCompComissao.html rename to sapl/legacy/scripts/original_forms/PeriodoCompComissao.html diff --git a/legacy/scripts/original_forms/PeriodoCompMesa.html b/sapl/legacy/scripts/original_forms/PeriodoCompMesa.html similarity index 100% rename from legacy/scripts/original_forms/PeriodoCompMesa.html rename to sapl/legacy/scripts/original_forms/PeriodoCompMesa.html diff --git a/legacy/scripts/original_forms/Proposicao.html b/sapl/legacy/scripts/original_forms/Proposicao.html similarity index 100% rename from legacy/scripts/original_forms/Proposicao.html rename to sapl/legacy/scripts/original_forms/Proposicao.html diff --git a/legacy/scripts/original_forms/Protocolo.html b/sapl/legacy/scripts/original_forms/Protocolo.html similarity index 100% rename from legacy/scripts/original_forms/Protocolo.html rename to sapl/legacy/scripts/original_forms/Protocolo.html diff --git a/legacy/scripts/original_forms/RegistroVotacao.html b/sapl/legacy/scripts/original_forms/RegistroVotacao.html similarity index 100% rename from legacy/scripts/original_forms/RegistroVotacao.html rename to sapl/legacy/scripts/original_forms/RegistroVotacao.html diff --git a/legacy/scripts/original_forms/Relatoria.html b/sapl/legacy/scripts/original_forms/Relatoria.html similarity index 100% rename from legacy/scripts/original_forms/Relatoria.html rename to sapl/legacy/scripts/original_forms/Relatoria.html diff --git a/legacy/scripts/original_forms/SessaoLegislativa.html b/sapl/legacy/scripts/original_forms/SessaoLegislativa.html similarity index 100% rename from legacy/scripts/original_forms/SessaoLegislativa.html rename to sapl/legacy/scripts/original_forms/SessaoLegislativa.html diff --git a/legacy/scripts/original_forms/SessaoPlenaria.html b/sapl/legacy/scripts/original_forms/SessaoPlenaria.html similarity index 100% rename from legacy/scripts/original_forms/SessaoPlenaria.html rename to sapl/legacy/scripts/original_forms/SessaoPlenaria.html diff --git a/legacy/scripts/original_forms/StatusTramitacao.html b/sapl/legacy/scripts/original_forms/StatusTramitacao.html similarity index 100% rename from legacy/scripts/original_forms/StatusTramitacao.html rename to sapl/legacy/scripts/original_forms/StatusTramitacao.html diff --git a/legacy/scripts/original_forms/StatusTramitacaoAdministrativo.html b/sapl/legacy/scripts/original_forms/StatusTramitacaoAdministrativo.html similarity index 100% rename from legacy/scripts/original_forms/StatusTramitacaoAdministrativo.html rename to sapl/legacy/scripts/original_forms/StatusTramitacaoAdministrativo.html diff --git a/legacy/scripts/original_forms/TipoAutor.html b/sapl/legacy/scripts/original_forms/TipoAutor.html similarity index 100% rename from legacy/scripts/original_forms/TipoAutor.html rename to sapl/legacy/scripts/original_forms/TipoAutor.html diff --git a/legacy/scripts/original_forms/TipoComissao.html b/sapl/legacy/scripts/original_forms/TipoComissao.html similarity index 100% rename from legacy/scripts/original_forms/TipoComissao.html rename to sapl/legacy/scripts/original_forms/TipoComissao.html diff --git a/legacy/scripts/original_forms/TipoDocumentoAdministrativo.html b/sapl/legacy/scripts/original_forms/TipoDocumentoAdministrativo.html similarity index 100% rename from legacy/scripts/original_forms/TipoDocumentoAdministrativo.html rename to sapl/legacy/scripts/original_forms/TipoDocumentoAdministrativo.html diff --git a/legacy/scripts/original_forms/TipoExpediente.html b/sapl/legacy/scripts/original_forms/TipoExpediente.html similarity index 100% rename from legacy/scripts/original_forms/TipoExpediente.html rename to sapl/legacy/scripts/original_forms/TipoExpediente.html diff --git a/legacy/scripts/original_forms/TipoNormaJuridica.html b/sapl/legacy/scripts/original_forms/TipoNormaJuridica.html similarity index 100% rename from legacy/scripts/original_forms/TipoNormaJuridica.html rename to sapl/legacy/scripts/original_forms/TipoNormaJuridica.html diff --git a/legacy/scripts/original_forms/TipoProposicao.html b/sapl/legacy/scripts/original_forms/TipoProposicao.html similarity index 100% rename from legacy/scripts/original_forms/TipoProposicao.html rename to sapl/legacy/scripts/original_forms/TipoProposicao.html diff --git a/legacy/scripts/original_forms/TipoResultadoVotacao.html b/sapl/legacy/scripts/original_forms/TipoResultadoVotacao.html similarity index 100% rename from legacy/scripts/original_forms/TipoResultadoVotacao.html rename to sapl/legacy/scripts/original_forms/TipoResultadoVotacao.html diff --git a/legacy/scripts/original_forms/TipoSessaoPlenaria.html b/sapl/legacy/scripts/original_forms/TipoSessaoPlenaria.html similarity index 100% rename from legacy/scripts/original_forms/TipoSessaoPlenaria.html rename to sapl/legacy/scripts/original_forms/TipoSessaoPlenaria.html diff --git a/legacy/scripts/original_forms/TipoSituacaoNorma.html b/sapl/legacy/scripts/original_forms/TipoSituacaoNorma.html similarity index 100% rename from legacy/scripts/original_forms/TipoSituacaoNorma.html rename to sapl/legacy/scripts/original_forms/TipoSituacaoNorma.html diff --git a/legacy/scripts/original_forms/Tramitacao.html b/sapl/legacy/scripts/original_forms/Tramitacao.html similarity index 100% rename from legacy/scripts/original_forms/Tramitacao.html rename to sapl/legacy/scripts/original_forms/Tramitacao.html diff --git a/legacy/scripts/original_forms/TramitacaoAdministrativo.html b/sapl/legacy/scripts/original_forms/TramitacaoAdministrativo.html similarity index 100% rename from legacy/scripts/original_forms/TramitacaoAdministrativo.html rename to sapl/legacy/scripts/original_forms/TramitacaoAdministrativo.html diff --git a/legacy/scripts/original_forms/UnidadeTramitacao.html b/sapl/legacy/scripts/original_forms/UnidadeTramitacao.html similarity index 100% rename from legacy/scripts/original_forms/UnidadeTramitacao.html rename to sapl/legacy/scripts/original_forms/UnidadeTramitacao.html diff --git a/legacy/scripts/original_forms/_auxiliares.txt b/sapl/legacy/scripts/original_forms/_auxiliares.txt similarity index 100% rename from legacy/scripts/original_forms/_auxiliares.txt rename to sapl/legacy/scripts/original_forms/_auxiliares.txt diff --git a/legacy/scripts/original_forms/_not_found_among_sapl25_models.txt b/sapl/legacy/scripts/original_forms/_not_found_among_sapl25_models.txt similarity index 100% rename from legacy/scripts/original_forms/_not_found_among_sapl25_models.txt rename to sapl/legacy/scripts/original_forms/_not_found_among_sapl25_models.txt diff --git a/legacy/scripts/original_forms/_principais.txt b/sapl/legacy/scripts/original_forms/_principais.txt similarity index 100% rename from legacy/scripts/original_forms/_principais.txt rename to sapl/legacy/scripts/original_forms/_principais.txt diff --git a/legacy/scripts/scrap_original_forms.py b/sapl/legacy/scripts/scrap_original_forms.py similarity index 98% rename from legacy/scripts/scrap_original_forms.py rename to sapl/legacy/scripts/scrap_original_forms.py index 3527875a5..57d280d87 100644 --- a/legacy/scripts/scrap_original_forms.py +++ b/sapl/legacy/scripts/scrap_original_forms.py @@ -9,9 +9,9 @@ from bs4 import BeautifulSoup from bs4.element import NavigableString, Tag from django.apps.config import AppConfig -from crispy_layout_mixin import heads_and_tails -from legacy.migration import appconfs, get_renames -from legacy.scripts.utils import getsourcelines +from sapl.crispy_layout_mixin import heads_and_tails +from sapl.legacy.migration import appconfs, get_renames +from sapl.legacy.scripts.utils import getsourcelines from sapl.utils import listify # to prevent removal by automatic organize imports on this file diff --git a/legacy/scripts/study.py b/sapl/legacy/scripts/study.py similarity index 89% rename from legacy/scripts/study.py rename to sapl/legacy/scripts/study.py index f7c6f446c..9049a9c06 100644 --- a/legacy/scripts/study.py +++ b/sapl/legacy/scripts/study.py @@ -1,6 +1,6 @@ from django.apps import apps -from .migration_base import legacy_app +from sapl.legacy.migration import legacy_app for model in apps.get_app_config('legacy').get_models(): if 'ind_excluido' in [f.name for f in model._meta.fields]: diff --git a/legacy/scripts/utils.py b/sapl/legacy/scripts/utils.py similarity index 100% rename from legacy/scripts/utils.py rename to sapl/legacy/scripts/utils.py diff --git a/legacy/test_renames.py b/sapl/legacy/test_renames.py similarity index 67% rename from legacy/test_renames.py rename to sapl/legacy/test_renames.py index 473f39567..27987aeeb 100644 --- a/legacy/test_renames.py +++ b/sapl/legacy/test_renames.py @@ -1,29 +1,29 @@ -import comissoes -import materia -import norma -import sessao +import sapl.comissoes +import sapl.materia +import sapl.norma +import sapl.sessao from .migration import appconfs, get_renames, legacy_app RENAMING_IGNORED_MODELS = [ - comissoes.models.Composicao, - norma.models.AssuntoNormaRelationship, + sapl.comissoes.models.Composicao, + sapl.norma.models.AssuntoNormaRelationship, # FIXME retirar daqui depois que a issue #218 for resolvida!!!!!!! - sessao.models.AcompanharMateria, + sapl.sessao.models.AcompanharMateria, ] RENAMING_IGNORED_FIELDS = [ - (comissoes.models.Participacao, {'composicao'}), - (materia.models.Proposicao, {'documento'}), - (materia.models.TipoProposicao, {'tipo_documento'}), - (materia.models.Tramitacao, {'ultima'}), - (sessao.models.SessaoPlenaria, {'finalizada', - 'upload_pauta', - 'upload_ata', - 'iniciada'}), - (sessao.models.ExpedienteMateria, {'votacao_aberta'}), - (sessao.models.OrdemDia, {'votacao_aberta'}), + (sapl.comissoes.models.Participacao, {'composicao'}), + (sapl.materia.models.Proposicao, {'documento'}), + (sapl.materia.models.TipoProposicao, {'tipo_documento'}), + (sapl.materia.models.Tramitacao, {'ultima'}), + (sapl.sessao.models.SessaoPlenaria, {'finalizada', + 'upload_pauta', + 'upload_ata', + 'iniciada'}), + (sapl.sessao.models.ExpedienteMateria, {'votacao_aberta'}), + (sapl.sessao.models.OrdemDia, {'votacao_aberta'}), ] diff --git a/legacy/views.py b/sapl/legacy/views.py similarity index 100% rename from legacy/views.py rename to sapl/legacy/views.py diff --git a/sapl/legacy_migration_settings.py b/sapl/legacy_migration_settings.py index 4c0425e57..4bc92976e 100644 --- a/sapl/legacy_migration_settings.py +++ b/sapl/legacy_migration_settings.py @@ -15,8 +15,8 @@ DATABASES['legacy'] = { 'PORT': '3306', } -DATABASE_ROUTERS = ['legacy.router.LegacyRouter', ] +DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ] MOMMY_CUSTOM_FIELDS_GEN = { - 'django.db.models.ForeignKey': 'legacy.migration.make_with_log' + 'django.db.models.ForeignKey': 'sapl.legacy.migration.make_with_log' } diff --git a/sapl/lexml/__init__.py b/sapl/lexml/__init__.py new file mode 100644 index 000000000..64c7375e9 --- /dev/null +++ b/sapl/lexml/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.lexml.apps.AppConfig' diff --git a/lexml/admin.py b/sapl/lexml/admin.py similarity index 100% rename from lexml/admin.py rename to sapl/lexml/admin.py diff --git a/lexml/apps.py b/sapl/lexml/apps.py similarity index 76% rename from lexml/apps.py rename to sapl/lexml/apps.py index 4098530b0..3a8bb3c72 100644 --- a/lexml/apps.py +++ b/sapl/lexml/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'lexml' + name = 'sapl.lexml' + label = 'lexml' verbose_name = _('LexML') diff --git a/lexml/layouts.yaml b/sapl/lexml/layouts.yaml similarity index 100% rename from lexml/layouts.yaml rename to sapl/lexml/layouts.yaml diff --git a/lexml/legacy.yaml b/sapl/lexml/legacy.yaml similarity index 100% rename from lexml/legacy.yaml rename to sapl/lexml/legacy.yaml diff --git a/lexml/migrations/0001_initial.py b/sapl/lexml/migrations/0001_initial.py similarity index 100% rename from lexml/migrations/0001_initial.py rename to sapl/lexml/migrations/0001_initial.py diff --git a/lexml/migrations/0002_auto_20150806_1614.py b/sapl/lexml/migrations/0002_auto_20150806_1614.py similarity index 100% rename from lexml/migrations/0002_auto_20150806_1614.py rename to sapl/lexml/migrations/0002_auto_20150806_1614.py diff --git a/lexml/migrations/0003_auto_20160216_1015.py b/sapl/lexml/migrations/0003_auto_20160216_1015.py similarity index 100% rename from lexml/migrations/0003_auto_20160216_1015.py rename to sapl/lexml/migrations/0003_auto_20160216_1015.py diff --git a/lexml/migrations/0004_auto_20160307_0918.py b/sapl/lexml/migrations/0004_auto_20160307_0918.py similarity index 100% rename from lexml/migrations/0004_auto_20160307_0918.py rename to sapl/lexml/migrations/0004_auto_20160307_0918.py diff --git a/legacy/scripts/__init__.py b/sapl/lexml/migrations/__init__.py similarity index 100% rename from legacy/scripts/__init__.py rename to sapl/lexml/migrations/__init__.py diff --git a/lexml/models.py b/sapl/lexml/models.py similarity index 100% rename from lexml/models.py rename to sapl/lexml/models.py diff --git a/lexml/urls.py b/sapl/lexml/urls.py similarity index 81% rename from lexml/urls.py rename to sapl/lexml/urls.py index 08258d079..e7d582030 100644 --- a/lexml/urls.py +++ b/sapl/lexml/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import include, url -from lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud +from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud from .apps import AppConfig diff --git a/lexml/views.py b/sapl/lexml/views.py similarity index 85% rename from lexml/views.py rename to sapl/lexml/views.py index 249d57aa3..5c988e43f 100644 --- a/lexml/views.py +++ b/sapl/lexml/views.py @@ -1,4 +1,4 @@ -from crud.base import Crud +from sapl.crud.base import Crud from .models import LexmlProvedor, LexmlPublicador diff --git a/locale/en/LC_MESSAGES/django.po b/sapl/locale/en/LC_MESSAGES/django.po similarity index 100% rename from locale/en/LC_MESSAGES/django.po rename to sapl/locale/en/LC_MESSAGES/django.po diff --git a/locale/es/LC_MESSAGES/django.po b/sapl/locale/es/LC_MESSAGES/django.po similarity index 100% rename from locale/es/LC_MESSAGES/django.po rename to sapl/locale/es/LC_MESSAGES/django.po diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/sapl/locale/pt_BR/LC_MESSAGES/django.po similarity index 100% rename from locale/pt_BR/LC_MESSAGES/django.po rename to sapl/locale/pt_BR/LC_MESSAGES/django.po diff --git a/sapl/materia/__init__.py b/sapl/materia/__init__.py new file mode 100644 index 000000000..be6e7166d --- /dev/null +++ b/sapl/materia/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.materia.apps.AppConfig' diff --git a/materia/admin.py b/sapl/materia/admin.py similarity index 100% rename from materia/admin.py rename to sapl/materia/admin.py diff --git a/materia/apps.py b/sapl/materia/apps.py similarity index 75% rename from materia/apps.py rename to sapl/materia/apps.py index 759206443..3ac053d1b 100644 --- a/materia/apps.py +++ b/sapl/materia/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'materia' + name = 'sapl.materia' + label = 'materia' verbose_name = _('Matéria') diff --git a/materia/forms.py b/sapl/materia/forms.py similarity index 95% rename from materia/forms.py rename to sapl/materia/forms.py index 9a6f34bda..de0ebf143 100644 --- a/materia/forms.py +++ b/sapl/materia/forms.py @@ -10,13 +10,12 @@ from django.db.models import Max from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import crispy_layout_mixin -import sapl -from comissoes.models import Comissao -from crispy_layout_mixin import form_actions -from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica +from sapl.comissoes.models import Comissao +from sapl.crispy_layout_mixin import form_actions, to_row +from sapl.norma.models import (LegislacaoCitada, NormaJuridica, + TipoNormaJuridica) from sapl.settings import MAX_DOC_UPLOAD_SIZE -from sapl.utils import RANGE_ANOS +from sapl.utils import RANGE_ANOS, autor_label, autor_modal from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, DespachoInicial, DocumentoAcessorio, MateriaLegislativa, @@ -110,7 +109,7 @@ class AcompanhamentoMateriaForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row([('email', 10)]) + row1 = to_row([('email', 10)]) row1.append( Column(form_actions(save_label='Cadastrar'), css_class='col-md-2') @@ -426,16 +425,16 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): self.filters['autoria__partido'].label = 'Partido do Autor' self.filters['relatoria__parlamentar_id'].label = 'Relatoria' - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('tipo', 12)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('numero', 4), ('ano', 4), ('numero_protocolo', 4)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('data_apresentacao', 6), ('data_publicacao', 6)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('autoria__autor', 0), (Button('pesquisar', 'Pesquisar Autor', @@ -443,19 +442,19 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): (Button('limpar', 'limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) - row5 = crispy_layout_mixin.to_row( + row5 = to_row( [('autoria__autor__tipo', 6), ('autoria__partido', 6)]) - row6 = crispy_layout_mixin.to_row( + row6 = to_row( [('relatoria__parlamentar_id', 6), ('local_origem_externa', 6)]) - row7 = crispy_layout_mixin.to_row( + row7 = to_row( [('tramitacao__unidade_tramitacao_destino', 6), ('tramitacao__status', 6)]) - row8 = crispy_layout_mixin.to_row( + row8 = to_row( [('em_tramitacao', 6), ('o', 6)]) - row9 = crispy_layout_mixin.to_row( + row9 = to_row( [('ementa', 12)]) self.form.helper = FormHelper() @@ -463,8 +462,8 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Matéria'), row1, row2, row3, - HTML(sapl.utils.autor_label), - HTML(sapl.utils.autor_modal), + HTML(autor_label), + HTML(autor_modal), row4, row5, row6, row7, row8, row9, form_actions(save_label='Pesquisar')) ) diff --git a/materia/layouts.yaml b/sapl/materia/layouts.yaml similarity index 99% rename from materia/layouts.yaml rename to sapl/materia/layouts.yaml index b52311a37..887a37349 100644 --- a/materia/layouts.yaml +++ b/sapl/materia/layouts.yaml @@ -1,4 +1,3 @@ - Origem: Origem: - nome:8 sigla diff --git a/materia/legacy.yaml b/sapl/materia/legacy.yaml similarity index 100% rename from materia/legacy.yaml rename to sapl/materia/legacy.yaml diff --git a/materia/migrations/0001_initial.py b/sapl/materia/migrations/0001_initial.py similarity index 100% rename from materia/migrations/0001_initial.py rename to sapl/materia/migrations/0001_initial.py diff --git a/materia/migrations/0002_auto_20150729_1310.py b/sapl/materia/migrations/0002_auto_20150729_1310.py similarity index 100% rename from materia/migrations/0002_auto_20150729_1310.py rename to sapl/materia/migrations/0002_auto_20150729_1310.py diff --git a/materia/migrations/0003_auto_20150729_1717.py b/sapl/materia/migrations/0003_auto_20150729_1717.py similarity index 100% rename from materia/migrations/0003_auto_20150729_1717.py rename to sapl/materia/migrations/0003_auto_20150729_1717.py diff --git a/materia/migrations/0004_materialegislativa_texto_original.py b/sapl/materia/migrations/0004_materialegislativa_texto_original.py similarity index 66% rename from materia/migrations/0004_materialegislativa_texto_original.py rename to sapl/materia/migrations/0004_materialegislativa_texto_original.py index 214864cf8..3f5adf474 100644 --- a/materia/migrations/0004_materialegislativa_texto_original.py +++ b/sapl/materia/migrations/0004_materialegislativa_texto_original.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import materia.models +import sapl.materia.models class Migration(migrations.Migration): @@ -16,6 +16,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='materialegislativa', name='texto_original', - field=models.FileField(null=True, blank=True, verbose_name='Texto original (PDF)', upload_to=materia.models.texto_upload_path), + field=models.FileField( + null=True, blank=True, verbose_name='Texto original (PDF)', upload_to=sapl.materia.models.texto_upload_path), ), ] diff --git a/materia/migrations/0005_auto_20150923_0941.py b/sapl/materia/migrations/0005_auto_20150923_0941.py similarity index 100% rename from materia/migrations/0005_auto_20150923_0941.py rename to sapl/materia/migrations/0005_auto_20150923_0941.py diff --git a/materia/migrations/0006_proposicao_status.py b/sapl/materia/migrations/0006_proposicao_status.py similarity index 100% rename from materia/migrations/0006_proposicao_status.py rename to sapl/materia/migrations/0006_proposicao_status.py diff --git a/materia/migrations/0007_auto_20151021_1200.py b/sapl/materia/migrations/0007_auto_20151021_1200.py similarity index 100% rename from materia/migrations/0007_auto_20151021_1200.py rename to sapl/materia/migrations/0007_auto_20151021_1200.py diff --git a/materia/migrations/0008_auto_20151029_1416.py b/sapl/materia/migrations/0008_auto_20151029_1416.py similarity index 100% rename from materia/migrations/0008_auto_20151029_1416.py rename to sapl/materia/migrations/0008_auto_20151029_1416.py diff --git a/materia/migrations/0009_auto_20151029_1420.py b/sapl/materia/migrations/0009_auto_20151029_1420.py similarity index 100% rename from materia/migrations/0009_auto_20151029_1420.py rename to sapl/materia/migrations/0009_auto_20151029_1420.py diff --git a/materia/migrations/0010_auto_20151117_1551.py b/sapl/materia/migrations/0010_auto_20151117_1551.py similarity index 75% rename from materia/migrations/0010_auto_20151117_1551.py rename to sapl/materia/migrations/0010_auto_20151117_1551.py index 7d64b431d..e9f095b1c 100644 --- a/materia/migrations/0010_auto_20151117_1551.py +++ b/sapl/materia/migrations/0010_auto_20151117_1551.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import materia.models +import sapl.materia.models class Migration(migrations.Migration): @@ -16,6 +16,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='materialegislativa', name='texto_original', - field=models.FileField(verbose_name='Texto Original (PDF)', upload_to=materia.models.texto_upload_path, blank=True, null=True), + field=models.FileField(verbose_name='Texto Original (PDF)', + upload_to=sapl.materia.models.texto_upload_path, blank=True, null=True), ), ] diff --git a/materia/migrations/0011_proposicao_texto_original.py b/sapl/materia/migrations/0011_proposicao_texto_original.py similarity index 63% rename from materia/migrations/0011_proposicao_texto_original.py rename to sapl/materia/migrations/0011_proposicao_texto_original.py index 8a7a79232..49f74fb6c 100644 --- a/materia/migrations/0011_proposicao_texto_original.py +++ b/sapl/materia/migrations/0011_proposicao_texto_original.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations -import materia.models +import sapl.materia.models class Migration(migrations.Migration): @@ -15,6 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='proposicao', name='texto_original', - field=models.FileField(upload_to=materia.models.texto_upload_path, verbose_name='Texto Original (PDF)', blank=True, null=True), + field=models.FileField(upload_to=sapl.materia.models.texto_upload_path, + verbose_name='Texto Original (PDF)', blank=True, null=True), ), ] diff --git a/materia/migrations/0012_auto_20151124_1328.py b/sapl/materia/migrations/0012_auto_20151124_1328.py similarity index 100% rename from materia/migrations/0012_auto_20151124_1328.py rename to sapl/materia/migrations/0012_auto_20151124_1328.py diff --git a/materia/migrations/0013_remove_tramitacao_ultima.py b/sapl/materia/migrations/0013_remove_tramitacao_ultima.py similarity index 100% rename from materia/migrations/0013_remove_tramitacao_ultima.py rename to sapl/materia/migrations/0013_remove_tramitacao_ultima.py diff --git a/materia/migrations/0014_autoria_partido.py b/sapl/materia/migrations/0014_autoria_partido.py similarity index 100% rename from materia/migrations/0014_autoria_partido.py rename to sapl/materia/migrations/0014_autoria_partido.py diff --git a/materia/migrations/0015_auto_20160216_1015.py b/sapl/materia/migrations/0015_auto_20160216_1015.py similarity index 100% rename from materia/migrations/0015_auto_20160216_1015.py rename to sapl/materia/migrations/0015_auto_20160216_1015.py diff --git a/materia/migrations/0016_auto_20160223_0813.py b/sapl/materia/migrations/0016_auto_20160223_0813.py similarity index 100% rename from materia/migrations/0016_auto_20160223_0813.py rename to sapl/materia/migrations/0016_auto_20160223_0813.py diff --git a/materia/migrations/0016_auto_20160225_0918.py b/sapl/materia/migrations/0016_auto_20160225_0918.py similarity index 100% rename from materia/migrations/0016_auto_20160225_0918.py rename to sapl/materia/migrations/0016_auto_20160225_0918.py diff --git a/materia/migrations/0017_acompanhamentomateria_confirmado.py b/sapl/materia/migrations/0017_acompanhamentomateria_confirmado.py similarity index 100% rename from materia/migrations/0017_acompanhamentomateria_confirmado.py rename to sapl/materia/migrations/0017_acompanhamentomateria_confirmado.py diff --git a/materia/migrations/0018_merge.py b/sapl/materia/migrations/0018_merge.py similarity index 100% rename from materia/migrations/0018_merge.py rename to sapl/materia/migrations/0018_merge.py diff --git a/materia/migrations/0019_auto_20160229_1321.py b/sapl/materia/migrations/0019_auto_20160229_1321.py similarity index 100% rename from materia/migrations/0019_auto_20160229_1321.py rename to sapl/materia/migrations/0019_auto_20160229_1321.py diff --git a/materia/migrations/0020_auto_20160229_1324.py b/sapl/materia/migrations/0020_auto_20160229_1324.py similarity index 100% rename from materia/migrations/0020_auto_20160229_1324.py rename to sapl/materia/migrations/0020_auto_20160229_1324.py diff --git a/materia/migrations/0021_auto_20160307_0905.py b/sapl/materia/migrations/0021_auto_20160307_0905.py similarity index 100% rename from materia/migrations/0021_auto_20160307_0905.py rename to sapl/materia/migrations/0021_auto_20160307_0905.py diff --git a/materia/migrations/0022_auto_20160309_1323.py b/sapl/materia/migrations/0022_auto_20160309_1323.py similarity index 100% rename from materia/migrations/0022_auto_20160309_1323.py rename to sapl/materia/migrations/0022_auto_20160309_1323.py diff --git a/materia/migrations/0023_auto_20160309_1407.py b/sapl/materia/migrations/0023_auto_20160309_1407.py similarity index 100% rename from materia/migrations/0023_auto_20160309_1407.py rename to sapl/materia/migrations/0023_auto_20160309_1407.py diff --git a/materia/migrations/0024_auto_20160311_1501.py b/sapl/materia/migrations/0024_auto_20160311_1501.py similarity index 100% rename from materia/migrations/0024_auto_20160311_1501.py rename to sapl/materia/migrations/0024_auto_20160311_1501.py diff --git a/materia/migrations/0025_auto_20160311_1613.py b/sapl/materia/migrations/0025_auto_20160311_1613.py similarity index 100% rename from materia/migrations/0025_auto_20160311_1613.py rename to sapl/materia/migrations/0025_auto_20160311_1613.py diff --git a/materia/migrations/0026_auto_20160322_1514.py b/sapl/materia/migrations/0026_auto_20160322_1514.py similarity index 100% rename from materia/migrations/0026_auto_20160322_1514.py rename to sapl/materia/migrations/0026_auto_20160322_1514.py diff --git a/materia/migrations/0027_auto_20160404_1409.py b/sapl/materia/migrations/0027_auto_20160404_1409.py similarity index 64% rename from materia/migrations/0027_auto_20160404_1409.py rename to sapl/materia/migrations/0027_auto_20160404_1409.py index c15f9015f..ee05c96ab 100644 --- a/materia/migrations/0027_auto_20160404_1409.py +++ b/sapl/materia/migrations/0027_auto_20160404_1409.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import materia.models +import sapl.materia.models import sapl.utils @@ -17,11 +17,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='materialegislativa', name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), + field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), ), migrations.AlterField( model_name='proposicao', name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), + field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), ), ] diff --git a/materia/migrations/0028_auto_20160419_1000.py b/sapl/materia/migrations/0028_auto_20160419_1000.py similarity index 100% rename from materia/migrations/0028_auto_20160419_1000.py rename to sapl/materia/migrations/0028_auto_20160419_1000.py diff --git a/materia/migrations/0028_auto_20160419_1056.py b/sapl/materia/migrations/0028_auto_20160419_1056.py similarity index 100% rename from materia/migrations/0028_auto_20160419_1056.py rename to sapl/materia/migrations/0028_auto_20160419_1056.py diff --git a/materia/migrations/0029_auto_20160428_1020.py b/sapl/materia/migrations/0029_auto_20160428_1020.py similarity index 100% rename from materia/migrations/0029_auto_20160428_1020.py rename to sapl/materia/migrations/0029_auto_20160428_1020.py diff --git a/materia/migrations/0029_merge.py b/sapl/materia/migrations/0029_merge.py similarity index 100% rename from materia/migrations/0029_merge.py rename to sapl/materia/migrations/0029_merge.py diff --git a/materia/migrations/0030_auto_20160429_1349.py b/sapl/materia/migrations/0030_auto_20160429_1349.py similarity index 100% rename from materia/migrations/0030_auto_20160429_1349.py rename to sapl/materia/migrations/0030_auto_20160429_1349.py diff --git a/materia/migrations/0030_auto_20160502_1630.py b/sapl/materia/migrations/0030_auto_20160502_1630.py similarity index 100% rename from materia/migrations/0030_auto_20160502_1630.py rename to sapl/materia/migrations/0030_auto_20160502_1630.py diff --git a/materia/migrations/0031_auto_20160502_1131.py b/sapl/materia/migrations/0031_auto_20160502_1131.py similarity index 100% rename from materia/migrations/0031_auto_20160502_1131.py rename to sapl/materia/migrations/0031_auto_20160502_1131.py diff --git a/materia/migrations/0031_merge.py b/sapl/materia/migrations/0031_merge.py similarity index 100% rename from materia/migrations/0031_merge.py rename to sapl/materia/migrations/0031_merge.py diff --git a/materia/migrations/0032_auto_20160503_0926.py b/sapl/materia/migrations/0032_auto_20160503_0926.py similarity index 100% rename from materia/migrations/0032_auto_20160503_0926.py rename to sapl/materia/migrations/0032_auto_20160503_0926.py diff --git a/materia/migrations/0032_merge.py b/sapl/materia/migrations/0032_merge.py similarity index 100% rename from materia/migrations/0032_merge.py rename to sapl/materia/migrations/0032_merge.py diff --git a/materia/migrations/0033_documentoacessorio_texto_original.py b/sapl/materia/migrations/0033_documentoacessorio_texto_original.py similarity index 71% rename from materia/migrations/0033_documentoacessorio_texto_original.py rename to sapl/materia/migrations/0033_documentoacessorio_texto_original.py index e7f37e1f5..43e89a395 100644 --- a/materia/migrations/0033_documentoacessorio_texto_original.py +++ b/sapl/materia/migrations/0033_documentoacessorio_texto_original.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import materia.models +import sapl.materia.models import sapl.utils @@ -17,6 +17,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='documentoacessorio', name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'), + field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'), ), ] diff --git a/materia/migrations/0034_auto_20160510_0946.py b/sapl/materia/migrations/0034_auto_20160510_0946.py similarity index 100% rename from materia/migrations/0034_auto_20160510_0946.py rename to sapl/materia/migrations/0034_auto_20160510_0946.py diff --git a/materia/migrations/0035_auto_20160510_0949.py b/sapl/materia/migrations/0035_auto_20160510_0949.py similarity index 100% rename from materia/migrations/0035_auto_20160510_0949.py rename to sapl/materia/migrations/0035_auto_20160510_0949.py diff --git a/materia/migrations/0036_merge.py b/sapl/materia/migrations/0036_merge.py similarity index 100% rename from materia/migrations/0036_merge.py rename to sapl/materia/migrations/0036_merge.py diff --git a/materia/migrations/0037_auto_20160520_1250.py b/sapl/materia/migrations/0037_auto_20160520_1250.py similarity index 71% rename from materia/migrations/0037_auto_20160520_1250.py rename to sapl/materia/migrations/0037_auto_20160520_1250.py index 9e1693668..d70ae7dca 100644 --- a/materia/migrations/0037_auto_20160520_1250.py +++ b/sapl/materia/migrations/0037_auto_20160520_1250.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import materia.models +import sapl.materia.models import sapl.utils @@ -17,6 +17,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='proposicao', name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), + field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), ), ] diff --git a/sapl/materia/migrations/0038_auto_20160612_1506.py b/sapl/materia/migrations/0038_auto_20160612_1506.py new file mode 100644 index 000000000..0ce74f84b --- /dev/null +++ b/sapl/materia/migrations/0038_auto_20160612_1506.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-06-12 18:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0037_auto_20160520_1250'), + ] + + operations = [ + migrations.AlterField( + model_name='statustramitacao', + name='indicador', + field=models.CharField(blank=True, choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação'), + ), + ] diff --git a/lexml/migrations/__init__.py b/sapl/materia/migrations/__init__.py similarity index 100% rename from lexml/migrations/__init__.py rename to sapl/materia/migrations/__init__.py diff --git a/materia/models.py b/sapl/materia/models.py similarity index 99% rename from materia/models.py rename to sapl/materia/models.py index 2a03a570b..ca433d7a6 100644 --- a/materia/models.py +++ b/sapl/materia/models.py @@ -2,8 +2,8 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -from comissoes.models import Comissao -from parlamentares.models import Parlamentar, Partido +from sapl.comissoes.models import Comissao +from sapl.parlamentares.models import Parlamentar, Partido from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, restringe_tipos_de_arquivo_txt, xstr) @@ -48,7 +48,7 @@ class Origem(models.Model): def get_materia_media_path(instance, subpath, filename): - return './materia/%s/%s/%s' % (instance, subpath, filename) + return './sapl/materia/%s/%s/%s' % (instance, subpath, filename) def texto_upload_path(instance, filename): diff --git a/materia/tests/test_email_templates.py b/sapl/materia/tests/test_email_templates.py similarity index 97% rename from materia/tests/test_email_templates.py rename to sapl/materia/tests/test_email_templates.py index 943c12a0a..03982b150 100644 --- a/materia/tests/test_email_templates.py +++ b/sapl/materia/tests/test_email_templates.py @@ -1,6 +1,6 @@ from django.core import mail -from materia.views import enviar_emails, load_email_templates +from sapl.materia.views import enviar_emails, load_email_templates def test_email_template_loading(): diff --git a/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py similarity index 89% rename from materia/tests/test_materia.py rename to sapl/materia/tests/test_materia.py index 44f77a75f..1386e294a 100644 --- a/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -2,13 +2,15 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from comissoes.models import Comissao, TipoComissao -from materia.models import (Anexada, Autor, Autoria, DespachoInicial, - DocumentoAcessorio, MateriaLegislativa, Numeracao, - Proposicao, RegimeTramitacao, StatusTramitacao, - TipoAutor, TipoDocumento, TipoMateriaLegislativa, - TipoProposicao, Tramitacao, UnidadeTramitacao) -from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica +from sapl.comissoes.models import Comissao, TipoComissao +from sapl.materia.models import (Anexada, Autor, Autoria, DespachoInicial, + DocumentoAcessorio, MateriaLegislativa, + Numeracao, Proposicao, RegimeTramitacao, + StatusTramitacao, TipoAutor, TipoDocumento, + TipoMateriaLegislativa, TipoProposicao, + Tramitacao, UnidadeTramitacao) +from sapl.norma.models import (LegislacaoCitada, NormaJuridica, + TipoNormaJuridica) def make_unidade_tramitacao(descricao): @@ -97,7 +99,7 @@ def test_materia_anexada_submit(client): materia_anexada = MateriaLegislativa.objects.get(numero=32, ano=2004) # Testa POST - response = client.post(reverse('materia:anexada_create', + response = client.post(reverse('sapl.materia:anexada_create', kwargs={'pk': materia_principal.pk}), {'tipo': materia_anexada.tipo.pk, 'numero': materia_anexada.numero, @@ -124,7 +126,7 @@ def test_autoria_submit(client): autor = mommy.make(Autor, tipo=tipo_autor, nome='Autor Teste') # Testa POST - response = client.post(reverse('materia:autoria_create', + response = client.post(reverse('sapl.materia:autoria_create', kwargs={'pk': materia_principal.pk}), {'autor': autor.pk, 'primeiro_autor': True, @@ -154,7 +156,7 @@ def test_despacho_inicial_submit(client): data_criacao='2016-03-18') # Testa POST - response = client.post(reverse('materia:despachoinicial_create', + response = client.post(reverse('sapl.materia:despachoinicial_create', kwargs={'pk': materia_principal.pk}), {'comissao': comissao.pk, 'salvar': 'salvar'}, @@ -173,7 +175,7 @@ def test_numeracao_submit(client): materia = make_materia_principal() # Testa POST - response = client.post(reverse('materia:numeracao_create', + response = client.post(reverse('sapl.materia:numeracao_create', kwargs={'pk': materia_principal.pk}), {'tipo_materia': materia.tipo.pk, 'numero_materia': materia.numero, @@ -205,7 +207,7 @@ def test_documento_acessorio_submit(client): descricao='Teste') # Testa POST - response = client.post(reverse('materia:documentoacessorio_create', + response = client.post(reverse('sapl.materia:documentoacessorio_create', kwargs={'pk': materia_principal.pk}), {'tipo': tipo.pk, 'nome': 'teste_nome', @@ -230,7 +232,7 @@ def test_legislacao_citada_submit(client): norma = make_norma() # Testa POST - response = client.post(reverse('materia:legislacaocitada_create', + response = client.post(reverse('sapl.materia:legislacaocitada_create', kwargs={'pk': materia_principal.pk}), {'tipo': norma.tipo.pk, 'numero': norma.numero, @@ -256,7 +258,7 @@ def test_tramitacao_submit(client): descricao='Status_Teste') # Testa POST response = client.post( - reverse('materia:tramitacao_create', + reverse('sapl.materia:tramitacao_create', kwargs={'pk': materia_principal.pk}), {'unidade_tramitacao_local': make_unidade_tramitacao( 'Unidade Local').pk, @@ -283,7 +285,7 @@ def test_tramitacao_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_anexada(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:anexada_create', + response = client.post(reverse('sapl.materia:anexada_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -302,7 +304,7 @@ def test_form_errors_anexada(client): def test_form_errors_autoria(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:autoria_create', + response = client.post(reverse('sapl.materia:autoria_create', kwargs={'pk': materia_principal.pk}), {'materia_id': materia_principal.pk, 'partido': '', @@ -318,7 +320,7 @@ def test_form_errors_autoria(client): def test_form_errors_despacho_inicial(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:despachoinicial_create', + response = client.post(reverse('sapl.materia:despachoinicial_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -331,7 +333,7 @@ def test_form_errors_despacho_inicial(client): def test_form_errors_documento_acessorio(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:documentoacessorio_create', + response = client.post(reverse('sapl.materia:documentoacessorio_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -346,7 +348,7 @@ def test_form_errors_documento_acessorio(client): def test_form_errors_legislacao_citada(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:legislacaocitada_create', + response = client.post(reverse('sapl.materia:legislacaocitada_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -363,7 +365,7 @@ def test_form_errors_legislacao_citada(client): def test_form_errors_numeracao(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:numeracao_create', + response = client.post(reverse('sapl.materia:numeracao_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -382,7 +384,7 @@ def test_form_errors_numeracao(client): def test_form_errors_tramitacao(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:tramitacao_create', + response = client.post(reverse('sapl.materia:tramitacao_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -403,7 +405,7 @@ def test_form_errors_tramitacao(client): def test_form_errors_relatoria(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia:relatoria_create', + response = client.post(reverse('sapl.materia:relatoria_create', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -416,7 +418,7 @@ def test_form_errors_relatoria(client): @pytest.mark.django_db(transaction=False) def test_proposicao_submit(client): - response = client.post(reverse('materia:proposicao_create'), + response = client.post(reverse('sapl.materia:proposicao_create'), {'tipo': mommy.make(TipoProposicao, pk=3).pk, 'descricao': 'Teste proposição', 'salvar': 'salvar'}, @@ -432,7 +434,7 @@ def test_proposicao_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_proposicao(client): - response = client.post(reverse('materia:proposicao_create'), + response = client.post(reverse('sapl.materia:proposicao_create'), {'salvar': 'salvar'}, follow=True) assert (response.context_data['form'].errors['tipo'] == diff --git a/materia/tests/test_materia_urls.py b/sapl/materia/tests/test_materia_urls.py similarity index 62% rename from materia/tests/test_materia_urls.py rename to sapl/materia/tests/test_materia_urls.py index 64e341c2d..a2f0fa667 100644 --- a/materia/tests/test_materia_urls.py +++ b/sapl/materia/tests/test_materia_urls.py @@ -3,17 +3,17 @@ from django.core.urlresolvers import reverse @pytest.mark.parametrize("test_input,kwargs,expected", [ - ('materia:relatoria_update', + ('sapl.materia:relatoria_update', {'pk': '11'}, '/materia/relatoria/11/edit'), - ('materia:tramitacao_update', + ('sapl.materia:tramitacao_update', {'pk': '8'}, '/materia/tramitacao/8/edit'), - ('materia:proposicao_create', {}, '/proposicao/create'), - ('materia:proposicao_update', + ('sapl.materia:proposicao_create', {}, '/proposicao/create'), + ('sapl.materia:proposicao_update', {'pk': '3'}, '/proposicao/3/edit'), - ('materia:proposicao_list', {}, '/proposicao/'), + ('sapl.materia:proposicao_list', {}, '/proposicao/'), ]) def test_reverse(test_input, kwargs, expected): assert reverse(test_input, kwargs=kwargs) == expected diff --git a/materia/urls.py b/sapl/materia/urls.py similarity index 71% rename from materia/urls.py rename to sapl/materia/urls.py index 1283164ce..dbc6499fc 100644 --- a/materia/urls.py +++ b/sapl/materia/urls.py @@ -1,19 +1,19 @@ from django.conf.urls import include, url -from materia.views import (AcompanhamentoConfirmarView, - AcompanhamentoExcluirView, - AcompanhamentoMateriaView, AnexadaCrud, AutorCrud, - AutoriaCrud, DespachoInicialCrud, - DocumentoAcessorioCrud, LegislacaoCitadaCrud, - MateriaLegislativaCrud, - MateriaLegislativaPesquisaView, MateriaTaView, - NumeracaoCrud, OrgaoCrud, OrigemCrud, - ProposicaoCrud, ProposicaoTaView, - RegimeTramitacaoCrud, RelatoriaCrud, - StatusTramitacaoCrud, TipoAutorCrud, - TipoDocumentoCrud, TipoFimRelatoriaCrud, - TipoMateriaCrud, TipoProposicaoCrud, TramitacaoCrud, - UnidadeTramitacaoCrud) +from sapl.materia.views import (AcompanhamentoConfirmarView, + AcompanhamentoExcluirView, + AcompanhamentoMateriaView, AnexadaCrud, + AutorCrud, AutoriaCrud, DespachoInicialCrud, + DocumentoAcessorioCrud, LegislacaoCitadaCrud, + MateriaLegislativaCrud, + MateriaLegislativaPesquisaView, MateriaTaView, + NumeracaoCrud, OrgaoCrud, OrigemCrud, + ProposicaoCrud, ProposicaoTaView, + RegimeTramitacaoCrud, RelatoriaCrud, + StatusTramitacaoCrud, TipoAutorCrud, + TipoDocumentoCrud, TipoFimRelatoriaCrud, + TipoMateriaCrud, TipoProposicaoCrud, + TramitacaoCrud, UnidadeTramitacaoCrud) from .apps import AppConfig diff --git a/materia/views.py b/sapl/materia/views.py similarity index 93% rename from materia/views.py rename to sapl/materia/views.py index d7ea41948..132080228 100644 --- a/materia/views.py +++ b/sapl/materia/views.py @@ -14,16 +14,14 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic import CreateView, TemplateView, UpdateView from django_filters.views import FilterView -import crispy_layout_mixin -import crud.base -import crud.masterdetail -import sapl -from base.models import CasaLegislativa -from compilacao.views import IntegracaoTaView -from crispy_layout_mixin import form_actions -from crud.base import Crud, make_pagination -from crud.masterdetail import MasterDetailCrud -from norma.models import LegislacaoCitada +from sapl.base.models import CasaLegislativa +from sapl.compilacao.views import IntegracaoTaView +from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row +from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, CrudListView, + CrudUpdateView, make_pagination) +from sapl.crud.masterdetail import MasterDetailCrud +from sapl.norma.models import LegislacaoCitada +from sapl.utils import autor_label, autor_modal, get_base_url from .forms import (AcompanhamentoMateriaForm, AnexadaForm, AutoriaForm, DespachoInicialForm, DocumentoAcessorioForm, @@ -58,10 +56,10 @@ class UnidadeTramitacaoCrud(Crud): model = UnidadeTramitacao help_path = 'unidade_tramitacao' - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = UnidadeTramitacaoForm - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = UnidadeTramitacaoForm @@ -69,24 +67,24 @@ class ProposicaoCrud(Crud): model = Proposicao help_path = '' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['data_envio', 'descricao', 'tipo'] - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = ProposicaoForm @property def layout_key(self): return 'ProposicaoCreate' - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = ProposicaoForm @property def layout_key(self): return 'ProposicaoCreate' - class ListView(crud.base.CrudListView): + class ListView(CrudListView): ordering = ['-data_envio', 'descricao'] def get_rows(self, object_list): @@ -104,12 +102,13 @@ class ProposicaoCrud(Crud): if not proposicao.data_envio: proposicao.delete() - return HttpResponseRedirect(reverse('materia:proposicao_list')) + return HttpResponseRedirect( + reverse('sapl.materia:proposicao_list')) else: proposicao.data_envio = None proposicao.save() return HttpResponseRedirect( - reverse('materia:proposicao_detail', + reverse('sapl.materia:proposicao_detail', kwargs={'pk': proposicao.pk})) @@ -179,7 +178,7 @@ class TramitacaoCrud(MasterDetailCrud): def delete(self, request, *args, **kwargs): tramitacao = Tramitacao.objects.get(id=self.kwargs['pk']) materia = MateriaLegislativa.objects.get(id=tramitacao.materia.id) - url = reverse('materia:tramitacao_list', + url = reverse('sapl.materia:tramitacao_list', kwargs={'pk': tramitacao.materia.id}) if tramitacao.pk != materia.tramitacao_set.last().pk: @@ -192,7 +191,7 @@ class TramitacaoCrud(MasterDetailCrud): def montar_row_autor(): - autor_row = crispy_layout_mixin.to_row( + autor_row = to_row( [('autor', 0), (Button('pesquisar', 'Pesquisar Autor', @@ -207,12 +206,11 @@ def montar_row_autor(): def montar_helper_documento_acessorio(self): autor_row = montar_row_autor() self.helper = FormHelper() - self.helper.layout = crispy_layout_mixin.SaplFormLayout( - *self.get_layout()) + self.helper.layout = SaplFormLayout(*self.get_layout()) # Adiciona o novo campo 'autor' e mecanismo de busca - self.helper.layout[0][0].append(HTML(sapl.utils.autor_label)) - self.helper.layout[0][0].append(HTML(sapl.utils.autor_modal)) + self.helper.layout[0][0].append(HTML(autor_label)) + self.helper.layout[0][0].append(HTML(autor_modal)) self.helper.layout[0][1] = autor_row # Remove botões que estão fora do form @@ -290,7 +288,7 @@ class LegislacaoCitadaCrud(MasterDetailCrud): list_field_names = ['norma', 'disposicoes'] def resolve_url(self, suffix, args=None): - namespace = 'materia' + namespace = 'sapl.materia' return reverse('%s:%s' % (namespace, self.url_name(suffix)), args=args) @@ -357,7 +355,7 @@ class MateriaLegislativaCrud(Crud): model = MateriaLegislativa help_path = 'materia_legislativa' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['tipo', 'numero', 'ano', 'data_apresentacao'] @@ -394,13 +392,13 @@ class DocumentoAcessorioView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('materia:documento_acessorio', kwargs={'pk': pk}) + return reverse('sapl.materia:documento_acessorio', kwargs={'pk': pk}) class AcompanhamentoConfirmarView(TemplateView): def get_redirect_url(self): - return reverse("sessao:list_pauta_sessao") + return reverse('sapl.sessao:list_pauta_sessao') def get(self, request, *args, **kwargs): materia_id = kwargs['pk'] @@ -417,7 +415,7 @@ class AcompanhamentoConfirmarView(TemplateView): class AcompanhamentoExcluirView(TemplateView): def get_redirect_url(self): - return reverse("sessao:list_pauta_sessao") + return reverse('sapl.sessao:list_pauta_sessao') def get(self, request, *args, **kwargs): materia_id = kwargs['pk'] @@ -571,7 +569,7 @@ class AcompanhamentoMateriaView(CreateView): 'materia': materia}) def get_success_url(self): - return reverse('sessao:list_pauta_sessao') + return reverse('sapl.sessao:list_pauta_sessao') def load_email_templates(templates, context={}): @@ -599,10 +597,10 @@ def criar_email_confirmacao(request, casa_legislativa, materia, hash_txt=''): casa_legislativa.municipio + '-' + casa_legislativa.uf) - base_url = sapl.utils.get_base_url(request) - materia_url = reverse('materia:acompanhar_materia', + base_url = get_base_url(request) + materia_url = reverse('sapl.materia:acompanhar_materia', kwargs={'pk': materia.id}) - confirmacao_url = reverse('materia:acompanhar_confirmar', + confirmacao_url = reverse('sapl.materia:acompanhar_confirmar', kwargs={'pk': materia.id}) autores = [] @@ -636,10 +634,10 @@ def criar_email_tramitacao(request, casa_legislativa, materia, hash_txt=''): casa_legislativa.municipio + '-' + casa_legislativa.uf) - base_url = sapl.utils.get_base_url(request) - url_materia = reverse('materia:acompanhar_materia', + base_url = get_base_url(request) + url_materia = reverse('sapl.materia:acompanhar_materia', kwargs={'pk': materia.id}) - url_excluir = reverse('materia:acompanhar_excluir', + url_excluir = reverse('sapl.materia:acompanhar_excluir', kwargs={'pk': materia.id}) autores = [] diff --git a/sapl/norma/__init__.py b/sapl/norma/__init__.py new file mode 100644 index 000000000..497a3720d --- /dev/null +++ b/sapl/norma/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.norma.apps.AppConfig' diff --git a/norma/admin.py b/sapl/norma/admin.py similarity index 100% rename from norma/admin.py rename to sapl/norma/admin.py diff --git a/norma/apps.py b/sapl/norma/apps.py similarity index 77% rename from norma/apps.py rename to sapl/norma/apps.py index 424c2e996..effd4f271 100644 --- a/norma/apps.py +++ b/sapl/norma/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'norma' + name = 'sapl.norma' + label = 'norma' verbose_name = _('Norma Jurídica') diff --git a/norma/forms.py b/sapl/norma/forms.py similarity index 85% rename from norma/forms.py rename to sapl/norma/forms.py index dc254ab08..f99094a76 100644 --- a/norma/forms.py +++ b/sapl/norma/forms.py @@ -6,9 +6,8 @@ from django import forms from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.forms import ModelForm -import crispy_layout_mixin -from crispy_layout_mixin import form_actions -from materia.models import MateriaLegislativa, TipoMateriaLegislativa +from sapl.crispy_layout_mixin import form_actions, to_row +from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.settings import MAX_DOC_UPLOAD_SIZE from sapl.utils import RANGE_ANOS @@ -27,8 +26,8 @@ class NormaJuridicaPesquisaForm(ModelForm): input_formats=['%d/%m/%Y'], required=False, widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) + format='%d/%m/%Y', + attrs={'class': 'dateinput'})) periodo_final = forms.DateField(label=u'Período Final', input_formats=['%d/%m/%Y'], @@ -41,15 +40,15 @@ class NormaJuridicaPesquisaForm(ModelForm): input_formats=['%d/%m/%Y'], required=False, widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) + format='%d/%m/%Y', + attrs={'class': 'dateinput'})) publicacao_final = forms.DateField(label=u'Publicação Final', input_formats=['%d/%m/%Y'], required=False, widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) + format='%d/%m/%Y', + attrs={'class': 'dateinput'})) ano = forms.ModelChoiceField( label='Ano', @@ -71,23 +70,23 @@ class NormaJuridicaPesquisaForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('tipo', 12)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('numero', 6), ('ano', 6)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('periodo_inicial', 6), ('periodo_final', 6)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('publicacao_inicial', 6), ('publicacao_final', 6)]) self.helper = FormHelper() self.helper.layout = Layout( - Fieldset('Pesquisa Norma Juridica', - row1, row2, row3, row4), - form_actions(save_label='Pesquisar') + Fieldset('Pesquisa Norma Juridica', + row1, row2, row3, row4), + form_actions(save_label='Pesquisar') ) super(NormaJuridicaPesquisaForm, self).__init__(*args, **kwargs) diff --git a/norma/layouts.yaml b/sapl/norma/layouts.yaml similarity index 100% rename from norma/layouts.yaml rename to sapl/norma/layouts.yaml diff --git a/norma/legacy.yaml b/sapl/norma/legacy.yaml similarity index 100% rename from norma/legacy.yaml rename to sapl/norma/legacy.yaml diff --git a/norma/migrations/0001_initial.py b/sapl/norma/migrations/0001_initial.py similarity index 100% rename from norma/migrations/0001_initial.py rename to sapl/norma/migrations/0001_initial.py diff --git a/norma/migrations/0002_auto_20150729_1717.py b/sapl/norma/migrations/0002_auto_20150729_1717.py similarity index 100% rename from norma/migrations/0002_auto_20150729_1717.py rename to sapl/norma/migrations/0002_auto_20150729_1717.py diff --git a/norma/migrations/0003_auto_20150906_0239.py b/sapl/norma/migrations/0003_auto_20150906_0239.py similarity index 100% rename from norma/migrations/0003_auto_20150906_0239.py rename to sapl/norma/migrations/0003_auto_20150906_0239.py diff --git a/norma/migrations/0004_auto_20150907_0004.py b/sapl/norma/migrations/0004_auto_20150907_0004.py similarity index 100% rename from norma/migrations/0004_auto_20150907_0004.py rename to sapl/norma/migrations/0004_auto_20150907_0004.py diff --git a/norma/migrations/0005_auto_20150915_1141.py b/sapl/norma/migrations/0005_auto_20150915_1141.py similarity index 100% rename from norma/migrations/0005_auto_20150915_1141.py rename to sapl/norma/migrations/0005_auto_20150915_1141.py diff --git a/norma/migrations/0006_auto_20151025_1427.py b/sapl/norma/migrations/0006_auto_20151025_1427.py similarity index 100% rename from norma/migrations/0006_auto_20151025_1427.py rename to sapl/norma/migrations/0006_auto_20151025_1427.py diff --git a/norma/migrations/0007_auto_20151130_1632.py b/sapl/norma/migrations/0007_auto_20151130_1632.py similarity index 100% rename from norma/migrations/0007_auto_20151130_1632.py rename to sapl/norma/migrations/0007_auto_20151130_1632.py diff --git a/norma/migrations/0008_normajuridica_texto_integral.py b/sapl/norma/migrations/0008_normajuridica_texto_integral.py similarity index 66% rename from norma/migrations/0008_normajuridica_texto_integral.py rename to sapl/norma/migrations/0008_normajuridica_texto_integral.py index 9f44184ad..7415852b5 100644 --- a/norma/migrations/0008_normajuridica_texto_integral.py +++ b/sapl/norma/migrations/0008_normajuridica_texto_integral.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations -import norma.models +import sapl.norma.models class Migration(migrations.Migration): @@ -15,6 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='normajuridica', name='texto_integral', - field=models.FileField(null=True, verbose_name='Texto Integral', upload_to=norma.models.texto_upload_path, blank=True), + field=models.FileField( + null=True, verbose_name='Texto Integral', upload_to=sapl.norma.models.texto_upload_path, blank=True), ), ] diff --git a/norma/migrations/0009_auto_20160106_1511.py b/sapl/norma/migrations/0009_auto_20160106_1511.py similarity index 100% rename from norma/migrations/0009_auto_20160106_1511.py rename to sapl/norma/migrations/0009_auto_20160106_1511.py diff --git a/norma/migrations/0010_auto_20160216_1015.py b/sapl/norma/migrations/0010_auto_20160216_1015.py similarity index 100% rename from norma/migrations/0010_auto_20160216_1015.py rename to sapl/norma/migrations/0010_auto_20160216_1015.py diff --git a/norma/migrations/0011_auto_20160307_1153.py b/sapl/norma/migrations/0011_auto_20160307_1153.py similarity index 100% rename from norma/migrations/0011_auto_20160307_1153.py rename to sapl/norma/migrations/0011_auto_20160307_1153.py diff --git a/norma/migrations/0012_auto_20160309_1407.py b/sapl/norma/migrations/0012_auto_20160309_1407.py similarity index 100% rename from norma/migrations/0012_auto_20160309_1407.py rename to sapl/norma/migrations/0012_auto_20160309_1407.py diff --git a/norma/migrations/0013_auto_20160503_0926.py b/sapl/norma/migrations/0013_auto_20160503_0926.py similarity index 100% rename from norma/migrations/0013_auto_20160503_0926.py rename to sapl/norma/migrations/0013_auto_20160503_0926.py diff --git a/norma/migrations/0013_auto_20160510_1404.py b/sapl/norma/migrations/0013_auto_20160510_1404.py similarity index 100% rename from norma/migrations/0013_auto_20160510_1404.py rename to sapl/norma/migrations/0013_auto_20160510_1404.py diff --git a/norma/migrations/0014_merge.py b/sapl/norma/migrations/0014_merge.py similarity index 100% rename from norma/migrations/0014_merge.py rename to sapl/norma/migrations/0014_merge.py diff --git a/materia/migrations/__init__.py b/sapl/norma/migrations/__init__.py similarity index 100% rename from materia/migrations/__init__.py rename to sapl/norma/migrations/__init__.py diff --git a/norma/models.py b/sapl/norma/models.py similarity index 95% rename from norma/models.py rename to sapl/norma/models.py index 84c14d74b..8c47d4c72 100644 --- a/norma/models.py +++ b/sapl/norma/models.py @@ -1,9 +1,11 @@ +from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -from materia.models import MateriaLegislativa +from sapl.compilacao.models import TextoArticulado +from sapl.materia.models import MateriaLegislativa from sapl.utils import RANGE_ANOS, YES_NO_CHOICES @@ -54,7 +56,7 @@ class TipoNormaJuridica(models.Model): def get_norma_media_path(instance, subpath, filename): - return './norma/%s/%s/%s' % (instance, subpath, filename) + return './sapl/norma/%s/%s/%s' % (instance, subpath, filename) def texto_upload_path(instance, filename): @@ -108,6 +110,9 @@ class NormaJuridica(models.Model): data_vigencia = models.DateField(blank=True, null=True) timestamp = models.DateTimeField() + texto_articulado = GenericRelation( + TextoArticulado, related_query_name='texto_articulado') + class Meta: verbose_name = _('Norma Jurídica') verbose_name_plural = _('Normas Jurídicas') diff --git a/norma/tests/test_norma.py b/sapl/norma/tests/test_norma.py similarity index 89% rename from norma/tests/test_norma.py rename to sapl/norma/tests/test_norma.py index b510aa566..16c980d15 100644 --- a/norma/tests/test_norma.py +++ b/sapl/norma/tests/test_norma.py @@ -2,7 +2,7 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from norma.models import NormaJuridica, TipoNormaJuridica +from sapl.norma.models import NormaJuridica, TipoNormaJuridica @pytest.mark.django_db(transaction=False) @@ -13,7 +13,7 @@ def test_incluir_norma_submit(client): descricao='Teste') # Testa POST - response = client.post(reverse('norma:normajuridica_create'), + response = client.post(reverse('sapl.norma:normajuridica_create'), {'tipo': tipo.pk, 'numero': '1', 'ano': '2016', @@ -33,7 +33,7 @@ def test_incluir_norma_submit(client): @pytest.mark.django_db(transaction=False) def test_incluir_norma_errors(client): - response = client.post(reverse('norma:normajuridica_create'), + response = client.post(reverse('sapl.norma:normajuridica_create'), {'salvar': 'salvar'}, follow=True) diff --git a/norma/urls.py b/sapl/norma/urls.py similarity index 76% rename from norma/urls.py rename to sapl/norma/urls.py index d99713597..a042e0236 100644 --- a/norma/urls.py +++ b/sapl/norma/urls.py @@ -1,7 +1,8 @@ from django.conf.urls import include, url -from norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView, - NormaTaView, PesquisaNormaListView, TipoNormaCrud) +from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView, + NormaTaView, PesquisaNormaListView, + TipoNormaCrud) from .apps import AppConfig diff --git a/norma/views.py b/sapl/norma/views.py similarity index 93% rename from norma/views.py rename to sapl/norma/views.py index 711d3ff60..5f7624ae6 100644 --- a/norma/views.py +++ b/sapl/norma/views.py @@ -3,9 +3,9 @@ from datetime import datetime from django.shortcuts import redirect from django.views.generic import FormView, ListView -import crud.base -from compilacao.views import IntegracaoTaView -from crud.base import Crud, make_pagination +from sapl.compilacao.views import IntegracaoTaView +from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, + CrudUpdateView, make_pagination) from .forms import NormaJuridicaForm, NormaJuridicaPesquisaForm from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica, @@ -20,7 +20,7 @@ class NormaCrud(Crud): model = NormaJuridica help_path = 'norma_juridica' - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = NormaJuridicaForm @property @@ -35,14 +35,14 @@ class NormaCrud(Crud): self.initial['numero_materia'] = norma.materia.numero return self.initial.copy() - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = NormaJuridicaForm @property def layout_key(self): return 'NormaJuridicaCreate' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['tipo', 'numero', 'ano', 'ementa'] @@ -68,7 +68,7 @@ class NormaPesquisaView(FormView): kwargs['publicacao_final'] = form.data['publicacao_final'] request.session['kwargs'] = kwargs - return redirect('norma:list_pesquisa_norma') + return redirect('sapl.norma:list_pesquisa_norma') class PesquisaNormaListView(ListView): diff --git a/sapl/painel/__init__.py b/sapl/painel/__init__.py new file mode 100644 index 000000000..4a9413e0f --- /dev/null +++ b/sapl/painel/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.painel.apps.AppConfig' diff --git a/painel/admin.py b/sapl/painel/admin.py similarity index 100% rename from painel/admin.py rename to sapl/painel/admin.py diff --git a/painel/apps.py b/sapl/painel/apps.py similarity index 77% rename from painel/apps.py rename to sapl/painel/apps.py index 1b46b6eba..7cd1002ec 100644 --- a/painel/apps.py +++ b/sapl/painel/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'painel' + name = 'sapl.painel' + label = 'painel' verbose_name = _('Painel Eletrônico') diff --git a/painel/layouts.yaml b/sapl/painel/layouts.yaml similarity index 100% rename from painel/layouts.yaml rename to sapl/painel/layouts.yaml diff --git a/painel/migrations/0001_initial.py b/sapl/painel/migrations/0001_initial.py similarity index 100% rename from painel/migrations/0001_initial.py rename to sapl/painel/migrations/0001_initial.py diff --git a/norma/migrations/__init__.py b/sapl/painel/migrations/__init__.py similarity index 100% rename from norma/migrations/__init__.py rename to sapl/painel/migrations/__init__.py diff --git a/painel/models.py b/sapl/painel/models.py similarity index 100% rename from painel/models.py rename to sapl/painel/models.py diff --git a/painel/tests/tests.py b/sapl/painel/tests/tests.py similarity index 100% rename from painel/tests/tests.py rename to sapl/painel/tests/tests.py diff --git a/painel/urls.py b/sapl/painel/urls.py similarity index 77% rename from painel/urls.py rename to sapl/painel/urls.py index 8a964b481..296b9cc8a 100644 --- a/painel/urls.py +++ b/sapl/painel/urls.py @@ -1,9 +1,9 @@ from django.conf.urls import url from .apps import AppConfig -from .views import controlador_painel # CronometroPainelCrud, -from .views import (cronometro_painel, get_dados_painel, painel_mensagem_view, - painel_parlamentar_view, painel_view, painel_votacao_view) +from .views import (controlador_painel, cronometro_painel, get_dados_painel, + painel_mensagem_view, painel_parlamentar_view, painel_view, + painel_votacao_view) app_name = AppConfig.name diff --git a/painel/views.py b/sapl/painel/views.py similarity index 97% rename from painel/views.py rename to sapl/painel/views.py index 497bdc672..a4baa0c2e 100644 --- a/painel/views.py +++ b/sapl/painel/views.py @@ -5,12 +5,12 @@ from django.http import HttpResponse, JsonResponse from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ -from crud.base import Crud -from painel.models import Painel -from parlamentares.models import Filiacao -from sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, - RegistroVotacao, SessaoPlenaria, - SessaoPlenariaPresenca, VotoParlamentar) +from sapl.crud.base import Crud +from sapl.painel.models import Painel +from sapl.parlamentares.models import Filiacao +from sapl.sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, + RegistroVotacao, SessaoPlenaria, + SessaoPlenariaPresenca, VotoParlamentar) from .models import Cronometro diff --git a/sapl/parlamentares/__init__.py b/sapl/parlamentares/__init__.py new file mode 100644 index 000000000..f459a5e37 --- /dev/null +++ b/sapl/parlamentares/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.parlamentares.apps.AppConfig' diff --git a/parlamentares/admin.py b/sapl/parlamentares/admin.py similarity index 100% rename from parlamentares/admin.py rename to sapl/parlamentares/admin.py diff --git a/parlamentares/apps.py b/sapl/parlamentares/apps.py similarity index 71% rename from parlamentares/apps.py rename to sapl/parlamentares/apps.py index 6dc201aa3..41f6d0b38 100644 --- a/parlamentares/apps.py +++ b/sapl/parlamentares/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'parlamentares' + name = 'sapl.parlamentares' + label = 'parlamentares' verbose_name = _('Parlamentares') diff --git a/parlamentares/forms.py b/sapl/parlamentares/forms.py similarity index 92% rename from parlamentares/forms.py rename to sapl/parlamentares/forms.py index 561ff5d5f..c61e4fb57 100644 --- a/parlamentares/forms.py +++ b/sapl/parlamentares/forms.py @@ -7,7 +7,6 @@ from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ from floppyforms.widgets import ClearableFileInput -import sapl from sapl.utils import intervalos_tem_intersecao from .models import (ComposicaoColigacao, Filiacao, Legislatura, Mandato, @@ -19,6 +18,7 @@ class ImageThumbnailFileInput(ClearableFileInput): class LegislaturaForm(ModelForm): + class Meta: model = Legislatura exclude = [] @@ -42,7 +42,7 @@ class ParlamentarForm(ModelForm): class Meta: model = Parlamentar exclude = [] - widgets = {'fotografia': sapl.utils.ImageThumbnailFileInput, + widgets = {'fotografia': ImageThumbnailFileInput, 'biografia': forms.Textarea( attrs={'id': 'texto-rico'})} @@ -88,14 +88,14 @@ def validar_datas(data_filiacao, data_desfiliacao, parlamentar, filiacao): # Novo registro inserido com filiacoes ja existentes if filiacao_atual_id not in filiacoes_id and len(filiacoes_id) > 0: - ultima_filiacao = todas_filiacoes.last() - # Se ultima filiacao aberta e insercao posterior a esta filiacao - if (not ultima_filiacao.data_desfiliacao and - data_filiacao >= ultima_filiacao.data): - error_msg = _("O parlamentar não pode se filiar \ + ultima_filiacao = todas_filiacoes.last() + # Se ultima filiacao aberta e insercao posterior a esta filiacao + if (not ultima_filiacao.data_desfiliacao and + data_filiacao >= ultima_filiacao.data): + error_msg = _("O parlamentar não pode se filiar \ a novo partido sem antes se \ desfiliar do partido anterior") - return [False, error_msg] + return [False, error_msg] # checa intervalos de interseccao error_msg = None diff --git a/parlamentares/layouts.yaml b/sapl/parlamentares/layouts.yaml similarity index 100% rename from parlamentares/layouts.yaml rename to sapl/parlamentares/layouts.yaml diff --git a/parlamentares/legacy.yaml b/sapl/parlamentares/legacy.yaml similarity index 100% rename from parlamentares/legacy.yaml rename to sapl/parlamentares/legacy.yaml diff --git a/parlamentares/migrations/0001_initial.py b/sapl/parlamentares/migrations/0001_initial.py similarity index 100% rename from parlamentares/migrations/0001_initial.py rename to sapl/parlamentares/migrations/0001_initial.py diff --git a/parlamentares/migrations/0002_auto_20150729_1310.py b/sapl/parlamentares/migrations/0002_auto_20150729_1310.py similarity index 100% rename from parlamentares/migrations/0002_auto_20150729_1310.py rename to sapl/parlamentares/migrations/0002_auto_20150729_1310.py diff --git a/parlamentares/migrations/0003_auto_20150729_1717.py b/sapl/parlamentares/migrations/0003_auto_20150729_1717.py similarity index 100% rename from parlamentares/migrations/0003_auto_20150729_1717.py rename to sapl/parlamentares/migrations/0003_auto_20150729_1717.py diff --git a/parlamentares/migrations/0004_auto_20150929_1425.py b/sapl/parlamentares/migrations/0004_auto_20150929_1425.py similarity index 100% rename from parlamentares/migrations/0004_auto_20150929_1425.py rename to sapl/parlamentares/migrations/0004_auto_20150929_1425.py diff --git a/parlamentares/migrations/0005_parlamentar_fotografia.py b/sapl/parlamentares/migrations/0005_parlamentar_fotografia.py similarity index 65% rename from parlamentares/migrations/0005_parlamentar_fotografia.py rename to sapl/parlamentares/migrations/0005_parlamentar_fotografia.py index db67012a2..c7aff3aa3 100644 --- a/parlamentares/migrations/0005_parlamentar_fotografia.py +++ b/sapl/parlamentares/migrations/0005_parlamentar_fotografia.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import parlamentares.models +import sapl.parlamentares.models class Migration(migrations.Migration): @@ -16,6 +16,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='parlamentar', name='fotografia', - field=models.FileField(blank=True, null=True, verbose_name='Fotografia', upload_to=parlamentares.models.foto_upload_path), + field=models.FileField( + blank=True, null=True, verbose_name='Fotografia', upload_to=sapl.parlamentares.models.foto_upload_path), ), ] diff --git a/parlamentares/migrations/0006_auto_20151119_1318.py b/sapl/parlamentares/migrations/0006_auto_20151119_1318.py similarity index 100% rename from parlamentares/migrations/0006_auto_20151119_1318.py rename to sapl/parlamentares/migrations/0006_auto_20151119_1318.py diff --git a/parlamentares/migrations/0007_auto_20151123_1258.py b/sapl/parlamentares/migrations/0007_auto_20151123_1258.py similarity index 100% rename from parlamentares/migrations/0007_auto_20151123_1258.py rename to sapl/parlamentares/migrations/0007_auto_20151123_1258.py diff --git a/parlamentares/migrations/0008_auto_20151126_1332.py b/sapl/parlamentares/migrations/0008_auto_20151126_1332.py similarity index 100% rename from parlamentares/migrations/0008_auto_20151126_1332.py rename to sapl/parlamentares/migrations/0008_auto_20151126_1332.py diff --git a/parlamentares/migrations/0009_auto_20151126_1334.py b/sapl/parlamentares/migrations/0009_auto_20151126_1334.py similarity index 100% rename from parlamentares/migrations/0009_auto_20151126_1334.py rename to sapl/parlamentares/migrations/0009_auto_20151126_1334.py diff --git a/parlamentares/migrations/0010_auto_20160107_1850.py b/sapl/parlamentares/migrations/0010_auto_20160107_1850.py similarity index 74% rename from parlamentares/migrations/0010_auto_20160107_1850.py rename to sapl/parlamentares/migrations/0010_auto_20160107_1850.py index 3035f0b9d..bee171cd3 100644 --- a/parlamentares/migrations/0010_auto_20160107_1850.py +++ b/sapl/parlamentares/migrations/0010_auto_20160107_1850.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations -import parlamentares.models +import sapl.parlamentares.models class Migration(migrations.Migration): @@ -15,6 +15,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='parlamentar', name='fotografia', - field=models.ImageField(null=True, verbose_name='Fotografia', blank=True, upload_to=parlamentares.models.foto_upload_path), + field=models.ImageField(null=True, verbose_name='Fotografia', + blank=True, upload_to=sapl.parlamentares.models.foto_upload_path), ), ] diff --git a/parlamentares/migrations/0011_auto_20160216_1015.py b/sapl/parlamentares/migrations/0011_auto_20160216_1015.py similarity index 100% rename from parlamentares/migrations/0011_auto_20160216_1015.py rename to sapl/parlamentares/migrations/0011_auto_20160216_1015.py diff --git a/parlamentares/migrations/0012_auto_20160307_0905.py b/sapl/parlamentares/migrations/0012_auto_20160307_0905.py similarity index 100% rename from parlamentares/migrations/0012_auto_20160307_0905.py rename to sapl/parlamentares/migrations/0012_auto_20160307_0905.py diff --git a/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py b/sapl/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py similarity index 100% rename from parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py rename to sapl/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py diff --git a/parlamentares/migrations/0013_merge.py b/sapl/parlamentares/migrations/0013_merge.py similarity index 100% rename from parlamentares/migrations/0013_merge.py rename to sapl/parlamentares/migrations/0013_merge.py diff --git a/parlamentares/migrations/0014_auto_20160318_1504.py b/sapl/parlamentares/migrations/0014_auto_20160318_1504.py similarity index 100% rename from parlamentares/migrations/0014_auto_20160318_1504.py rename to sapl/parlamentares/migrations/0014_auto_20160318_1504.py diff --git a/parlamentares/migrations/0015_auto_20160322_1401.py b/sapl/parlamentares/migrations/0015_auto_20160322_1401.py similarity index 100% rename from parlamentares/migrations/0015_auto_20160322_1401.py rename to sapl/parlamentares/migrations/0015_auto_20160322_1401.py diff --git a/parlamentares/migrations/0016_auto_20160404_1409.py b/sapl/parlamentares/migrations/0016_auto_20160404_1409.py similarity index 70% rename from parlamentares/migrations/0016_auto_20160404_1409.py rename to sapl/parlamentares/migrations/0016_auto_20160404_1409.py index c467f6c82..a10fb6c38 100644 --- a/parlamentares/migrations/0016_auto_20160404_1409.py +++ b/sapl/parlamentares/migrations/0016_auto_20160404_1409.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import parlamentares.models +import sapl.parlamentares.models import sapl.utils @@ -17,6 +17,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='parlamentar', name='fotografia', - field=models.ImageField(blank=True, null=True, upload_to=parlamentares.models.foto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Fotografia'), + field=models.ImageField(blank=True, null=True, upload_to=sapl.parlamentares.models.foto_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Fotografia'), ), ] diff --git a/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py b/sapl/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py similarity index 100% rename from parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py rename to sapl/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py diff --git a/parlamentares/migrations/0018_auto_20160510_0943.py b/sapl/parlamentares/migrations/0018_auto_20160510_0943.py similarity index 100% rename from parlamentares/migrations/0018_auto_20160510_0943.py rename to sapl/parlamentares/migrations/0018_auto_20160510_0943.py diff --git a/parlamentares/migrations/0019_auto_20160518_1136.py b/sapl/parlamentares/migrations/0019_auto_20160518_1136.py similarity index 100% rename from parlamentares/migrations/0019_auto_20160518_1136.py rename to sapl/parlamentares/migrations/0019_auto_20160518_1136.py diff --git a/parlamentares/migrations/0019_auto_20160518_1204.py b/sapl/parlamentares/migrations/0019_auto_20160518_1204.py similarity index 100% rename from parlamentares/migrations/0019_auto_20160518_1204.py rename to sapl/parlamentares/migrations/0019_auto_20160518_1204.py diff --git a/parlamentares/migrations/0020_auto_20160518_1201.py b/sapl/parlamentares/migrations/0020_auto_20160518_1201.py similarity index 100% rename from parlamentares/migrations/0020_auto_20160518_1201.py rename to sapl/parlamentares/migrations/0020_auto_20160518_1201.py diff --git a/parlamentares/migrations/0021_merge.py b/sapl/parlamentares/migrations/0021_merge.py similarity index 100% rename from parlamentares/migrations/0021_merge.py rename to sapl/parlamentares/migrations/0021_merge.py diff --git a/painel/migrations/__init__.py b/sapl/parlamentares/migrations/__init__.py similarity index 100% rename from painel/migrations/__init__.py rename to sapl/parlamentares/migrations/__init__.py diff --git a/parlamentares/models.py b/sapl/parlamentares/models.py similarity index 99% rename from parlamentares/models.py rename to sapl/parlamentares/models.py index b0a2cfc55..77c7319d4 100644 --- a/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -163,7 +163,7 @@ class SituacaoMilitar(models.Model): def get_foto_media_path(instance, subpath, filename): - return './parlamentar/%s/%s/%s' % (instance, subpath, filename) + return './sapl/parlamentar/%s/%s/%s' % (instance, subpath, filename) def foto_upload_path(instance, filename): diff --git a/parlamentares/tests/test_mandato.py b/sapl/parlamentares/tests/test_mandato.py similarity index 94% rename from parlamentares/tests/test_mandato.py rename to sapl/parlamentares/tests/test_mandato.py index 0e4ece06f..cc027da1f 100644 --- a/parlamentares/tests/test_mandato.py +++ b/sapl/parlamentares/tests/test_mandato.py @@ -3,7 +3,7 @@ from datetime import datetime import pytest from model_mommy import mommy -from parlamentares.models import Filiacao, Legislatura, Mandato +from sapl.parlamentares.models import Filiacao, Legislatura, Mandato pytestmark = pytest.mark.django_db diff --git a/parlamentares/tests/test_parlamentares.py b/sapl/parlamentares/tests/test_parlamentares.py similarity index 87% rename from parlamentares/tests/test_parlamentares.py rename to sapl/parlamentares/tests/test_parlamentares.py index 969af9de6..2739dcd62 100644 --- a/parlamentares/tests/test_parlamentares.py +++ b/sapl/parlamentares/tests/test_parlamentares.py @@ -2,15 +2,16 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from parlamentares.models import (Dependente, Filiacao, Legislatura, Mandato, - Parlamentar, Partido, TipoDependente) +from sapl.parlamentares.models import (Dependente, Filiacao, Legislatura, + Mandato, Parlamentar, Partido, + TipoDependente) @pytest.mark.django_db(transaction=False) def test_cadastro_parlamentar(client): legislatura = mommy.make(Legislatura) - url = reverse('parlamentares:parlamentar_create') + url = reverse('sapl.parlamentares:parlamentar_create') response = client.get(url) assert response.status_code == 200 @@ -36,7 +37,7 @@ def test_cadastro_parlamentar(client): @pytest.mark.django_db(transaction=False) def test_incluir_parlamentar_errors(client): - url = reverse('parlamentares:parlamentar_create') + url = reverse('sapl.parlamentares:parlamentar_create') response = client.post(url) erros_esperados = {campo: ['Este campo é obrigatório.'] for campo in ['legislatura', @@ -53,7 +54,7 @@ def test_filiacao_submit(client): mommy.make(Parlamentar, pk=14) mommy.make(Partido, pk=32) - client.post(reverse('parlamentares:filiacao_create', + client.post(reverse('sapl.parlamentares:filiacao_create', kwargs={'pk': 14}), {'partido': 32, 'data': '2016-03-22', @@ -70,7 +71,7 @@ def test_dependente_submit(client): mommy.make(Partido, pk=32) mommy.make(TipoDependente, pk=3) - client.post(reverse('parlamentares:dependente_create', + client.post(reverse('sapl.parlamentares:dependente_create', kwargs={'pk': 14}), {'nome': 'Eduardo', 'tipo': 3, @@ -86,7 +87,7 @@ def test_dependente_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_dependente(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares:dependente_create', + response = client.post(reverse('sapl.parlamentares:dependente_create', kwargs={'pk': 14}), {'salvar': 'salvar'}, follow=True) @@ -103,7 +104,7 @@ def test_form_errors_dependente(client): def test_form_errors_filiacao(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares:filiacao_create', + response = client.post(reverse('sapl.parlamentares:filiacao_create', kwargs={'pk': 14}), {'partido': '', 'salvar': 'salvar'}, @@ -120,7 +121,7 @@ def test_mandato_submit(client): mommy.make(Parlamentar, pk=14) mommy.make(Legislatura, pk=5) - client.post(reverse('parlamentares:mandato_create', + client.post(reverse('sapl.parlamentares:mandato_create', kwargs={'pk': 14}), {'legislatura': 5, 'data_fim_mandato': '2016-01-01', @@ -136,7 +137,7 @@ def test_mandato_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_mandato(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares:mandato_create', + response = client.post(reverse('sapl.parlamentares:mandato_create', kwargs={'pk': 14}), {'legislatura': '', 'salvar': 'salvar'}, diff --git a/parlamentares/urls.py b/sapl/parlamentares/urls.py similarity index 68% rename from parlamentares/urls.py rename to sapl/parlamentares/urls.py index de3525339..2235e5a12 100644 --- a/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -1,12 +1,13 @@ from django.conf.urls import include, url -from parlamentares.views import (CargoMesaCrud, ColigacaoCrud, - ComposicaoColigacaoCrud, DependenteCrud, - FiliacaoCrud, LegislaturaCrud, MandatoCrud, - MesaDiretoraView, NivelInstrucaoCrud, - ParlamentarCrud, PartidoCrud, - SessaoLegislativaCrud, TipoAfastamentoCrud, - TipoDependenteCrud, TipoMilitarCrud) +from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, + ComposicaoColigacaoCrud, DependenteCrud, + FiliacaoCrud, LegislaturaCrud, + MandatoCrud, MesaDiretoraView, + NivelInstrucaoCrud, ParlamentarCrud, + PartidoCrud, SessaoLegislativaCrud, + TipoAfastamentoCrud, TipoDependenteCrud, + TipoMilitarCrud) from .apps import AppConfig diff --git a/parlamentares/views.py b/sapl/parlamentares/views.py similarity index 93% rename from parlamentares/views.py rename to sapl/parlamentares/views.py index 4243ad214..629c6f50f 100644 --- a/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -5,10 +5,8 @@ from django.utils.datastructures import MultiValueDictKeyError from django.utils.translation import ugettext_lazy as _ from django.views.generic import FormView -import crud.base -import crud.masterdetail -from crud.base import Crud -from crud.masterdetail import MasterDetailCrud +from sapl.crud.base import Crud, CrudCreateView, CrudListView, CrudUpdateView +from sapl.crud.masterdetail import MasterDetailCrud from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm, ParlamentarCreateForm, ParlamentarForm) @@ -41,7 +39,7 @@ class ColigacaoCrud(Crud): model = Coligacao help_path = 'tabelas_auxiliares#coligacao' - class ListView(crud.base.CrudListView): + class ListView(CrudListView): ordering = ('-legislatura__data_inicio', 'nome') @@ -72,10 +70,10 @@ class LegislaturaCrud(Crud): model = Legislatura help_path = 'tabelas_auxiliares#legislatura' - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = LegislaturaForm - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = LegislaturaForm @@ -98,17 +96,17 @@ class ParlamentarCrud(Crud): model = Parlamentar help_path = '' - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = ParlamentarForm - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = ParlamentarCreateForm @property def layout_key(self): return 'ParlamentarCreate' - class ListView(crud.base.CrudListView): + class ListView(CrudListView): template_name = "parlamentares/parlamentares_list.html" paginate_by = None @@ -164,7 +162,7 @@ class ParlamentarCrud(Crud): class MesaDiretoraView(FormView): template_name = "mesa_diretora/mesa_diretora.html" - success_url = reverse_lazy('parlamentares:mesa_diretora') + success_url = reverse_lazy('sapl.parlamentares:mesa_diretora') # Essa função avisa quando se pode compor uma Mesa Legislativa) def validation(self, request): @@ -181,7 +179,7 @@ class MesaDiretoraView(FormView): def get(self, request, *args, **kwargs): - if (not Legislatura.objects.all() or + if (not Legislatura.objects.exists() or not SessaoLegislativa.objects.all()): return self.validation(request) @@ -229,7 +227,7 @@ class MesaDiretoraView(FormView): id=int(request.POST['cargo'])) composicao.save() - return redirect('parlamentares:mesa_diretora') + return redirect('sapl.parlamentares:mesa_diretora') elif 'Excluir' in request.POST: @@ -245,7 +243,7 @@ class MesaDiretoraView(FormView): cargo_id=int(ids[1]) ) composicao.delete() - return redirect('parlamentares:mesa_diretora') + return redirect('sapl.parlamentares:mesa_diretora') else: mesa = ComposicaoMesa.objects.filter( sessao_legislativa=request.POST['sessao']) diff --git a/sapl/protocoloadm/__init__.py b/sapl/protocoloadm/__init__.py new file mode 100644 index 000000000..181f6ddc5 --- /dev/null +++ b/sapl/protocoloadm/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.protocoloadm.apps.AppConfig' diff --git a/protocoloadm/admin.py b/sapl/protocoloadm/admin.py similarity index 100% rename from protocoloadm/admin.py rename to sapl/protocoloadm/admin.py diff --git a/protocoloadm/apps.py b/sapl/protocoloadm/apps.py similarity index 73% rename from protocoloadm/apps.py rename to sapl/protocoloadm/apps.py index dbba33948..8697e58d9 100644 --- a/protocoloadm/apps.py +++ b/sapl/protocoloadm/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'protocoloadm' + name = 'sapl.protocoloadm' + label = 'protocoloadm' verbose_name = _('Protocolo Administrativo') diff --git a/protocoloadm/forms.py b/sapl/protocoloadm/forms.py similarity index 85% rename from protocoloadm/forms.py rename to sapl/protocoloadm/forms.py index f01bc67fc..90d684a36 100644 --- a/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -8,12 +8,10 @@ from django.db import models from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import crispy_layout_mixin -import sapl -from crispy_layout_mixin import form_actions -from materia.forms import RangeWidgetOverride -from materia.models import Autor -from sapl.utils import RANGE_ANOS +from sapl.crispy_layout_mixin import form_actions, to_row +from sapl.materia.forms import RangeWidgetOverride +from sapl.materia.models import Autor +from sapl.utils import RANGE_ANOS, autor_label, autor_modal from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, TipoDocumentoAdministrativo, @@ -52,16 +50,18 @@ class ProtocoloFilterSet(django_filters.FilterSet): autor = django_filters.CharFilter(widget=forms.HiddenInput()) - tipo_protocolo = django_filters.ChoiceFilter(required=False, - label='Tipo de Protocolo', - choices=TIPOS_PROTOCOLO, - widget=forms.Select( - attrs={'class': 'selector'})) - tipo_processo = django_filters.ChoiceFilter(required=False, - label='Natureza do Processo', - choices=NATUREZA_PROCESSO, - widget=forms.Select( - attrs={'class': 'selector'})) + tipo_protocolo = django_filters.ChoiceFilter( + required=False, + label='Tipo de Protocolo', + choices=TIPOS_PROTOCOLO, + widget=forms.Select( + attrs={'class': 'selector'})) + tipo_processo = django_filters.ChoiceFilter( + required=False, + label='Natureza do Processo', + choices=NATUREZA_PROCESSO, + widget=forms.Select( + attrs={'class': 'selector'})) class Meta: model = Protocolo @@ -96,31 +96,31 @@ class ProtocoloFilterSet(django_filters.FilterSet): self.filters['autor'].label = 'Tipo de Matéria' self.filters['assunto_ementa'].label = 'Assunto' - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('numero', 4), ('ano', 4), ('data', 4)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('tipo_documento', 4), ('tipo_protocolo', 4), ('tipo_materia', 4)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('interessado', 6), ('assunto_ementa', 6)]) - row4 = crispy_layout_mixin.to_row( - [('autor', 0), - (Button('pesquisar', - 'Pesquisar Autor', - css_class='btn btn-primary btn-sm'), 2), - (Button('limpar', - 'Limpar Autor', - css_class='btn btn-primary btn-sm'), 10)]) - row5 = crispy_layout_mixin.to_row( + row4 = to_row( + [('autor', 0), + (Button('pesquisar', + 'Pesquisar Autor', + css_class='btn btn-primary btn-sm'), 2), + (Button('limpar', + 'Limpar Autor', + css_class='btn btn-primary btn-sm'), 10)]) + row5 = to_row( [('tipo_processo', 12)]) - row6 = crispy_layout_mixin.to_row( + row6 = to_row( [('o', 12)]) self.form.helper = FormHelper() @@ -129,11 +129,11 @@ class ProtocoloFilterSet(django_filters.FilterSet): Fieldset(_('Pesquisar Protocolo'), row1, row2, row3, - HTML(sapl.utils.autor_label), - HTML(sapl.utils.autor_modal), + HTML(autor_label), + HTML(autor_modal), row4, row5, row6, form_actions(save_label='Pesquisar')) - ) + ) class DocumentoAdministrativoFilterSet(django_filters.FilterSet): @@ -193,25 +193,25 @@ class DocumentoAdministrativoFilterSet(django_filters.FilterSet): self.filters['tramitacaoadministrativo__status'].label = 'Situação' self.filters[local_atual].label = 'Localização Atual' - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('tipo', 6), ('numero', 6)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('ano', 4), ('numero_protocolo', 4), ('data', 4)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('interessado', 4), ('assunto', 4), ('tramitacao', 4)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('tramitacaoadministrativo__unidade_tramitacao_destino', 6), ('tramitacaoadministrativo__status', 6)]) - row5 = crispy_layout_mixin.to_row( + row5 = to_row( [('o', 12)]) self.form.helper = FormHelper() @@ -221,7 +221,7 @@ class DocumentoAdministrativoFilterSet(django_filters.FilterSet): row1, row2, row3, row4, row5, form_actions(save_label='Pesquisar')) - ) + ) class AnularProcoloAdmForm(ModelForm): @@ -276,10 +276,10 @@ class AnularProcoloAdmForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('numero', 6), ('ano', 6)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('justificativa_anulacao', 12)]) self.helper = FormHelper() @@ -338,18 +338,18 @@ class ProtocoloDocumentForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [(InlineRadios('numeracao'), 12)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [(InlineRadios('tipo_protocolo'), 12)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('tipo_documento', 6), ('num_paginas', 6)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('assunto', 12)]) - row5 = crispy_layout_mixin.to_row( + row5 = to_row( [('interessado', 12)]) - row6 = crispy_layout_mixin.to_row( + row6 = to_row( [('observacao', 12)]) self.helper = FormHelper() @@ -405,13 +405,13 @@ class ProtocoloMateriaForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [(InlineRadios('numeracao'), 12)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('tipo_materia', 4), (InlineRadios('tipo_protocolo'), 4), ('numero_paginas', 4)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('autor', 0), (Button('pesquisar', 'Pesquisar Autor', @@ -419,7 +419,7 @@ class ProtocoloMateriaForm(ModelForm): (Button('limpar', 'limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('observacao', 12)]) self.helper = FormHelper() @@ -427,8 +427,8 @@ class ProtocoloMateriaForm(ModelForm): Fieldset(_('Protocolo - Opção de Numeração'), row1), Fieldset(_('Identificação da Matéria'), row2, - HTML(sapl.utils.autor_label), - HTML(sapl.utils.autor_modal), + HTML(autor_label), + HTML(autor_modal), row3, row4, form_actions(save_label='Protocolar Matéria') @@ -485,15 +485,15 @@ class DocumentoAcessorioAdministrativoForm(ModelForm): def __init__(self, excluir=False, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('tipo', 4), ('nome', 4), ('data', 4)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('autor', 12)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('arquivo', 12)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('assunto', 12)]) more = [] @@ -570,25 +570,25 @@ class DocumentoAdministrativoForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('tipo', 4), ('numero', 4), ('ano', 4)]) - row2 = crispy_layout_mixin.to_row( + row2 = to_row( [('data', 6), ('numero_protocolo', 6)]) - row3 = crispy_layout_mixin.to_row( + row3 = to_row( [('assunto', 12)]) - row4 = crispy_layout_mixin.to_row( + row4 = to_row( [('interessado', 9), ('tramitacao', 3)]) - row5 = crispy_layout_mixin.to_row( + row5 = to_row( [('texto_integral', 12)]) - row6 = crispy_layout_mixin.to_row( + row6 = to_row( [('dias_prazo', 6), ('data_fim_prazo', 6)]) - row7 = crispy_layout_mixin.to_row( + row7 = to_row( [('observacao', 12)]) self.helper = FormHelper() diff --git a/protocoloadm/layouts.yaml b/sapl/protocoloadm/layouts.yaml similarity index 100% rename from protocoloadm/layouts.yaml rename to sapl/protocoloadm/layouts.yaml diff --git a/protocoloadm/legacy.yaml b/sapl/protocoloadm/legacy.yaml similarity index 100% rename from protocoloadm/legacy.yaml rename to sapl/protocoloadm/legacy.yaml diff --git a/protocoloadm/migrations/0001_initial.py b/sapl/protocoloadm/migrations/0001_initial.py similarity index 100% rename from protocoloadm/migrations/0001_initial.py rename to sapl/protocoloadm/migrations/0001_initial.py diff --git a/protocoloadm/migrations/0002_auto_20150729_1717.py b/sapl/protocoloadm/migrations/0002_auto_20150729_1717.py similarity index 100% rename from protocoloadm/migrations/0002_auto_20150729_1717.py rename to sapl/protocoloadm/migrations/0002_auto_20150729_1717.py diff --git a/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py b/sapl/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py similarity index 75% rename from protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py rename to sapl/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py index 7d41c8776..24aa43a71 100644 --- a/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py +++ b/sapl/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import protocoloadm.models +import sapl.protocoloadm.models class Migration(migrations.Migration): @@ -16,6 +16,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='documentoacessorioadministrativo', name='texto_integral', - field=models.FileField(verbose_name='Texto Integral', blank=True, null=True, upload_to=protocoloadm.models.texto_upload_path), + field=models.FileField(verbose_name='Texto Integral', blank=True, + null=True, upload_to=sapl.protocoloadm.models.texto_upload_path), ), ] diff --git a/protocoloadm/migrations/0004_auto_20151007_1035.py b/sapl/protocoloadm/migrations/0004_auto_20151007_1035.py similarity index 62% rename from protocoloadm/migrations/0004_auto_20151007_1035.py rename to sapl/protocoloadm/migrations/0004_auto_20151007_1035.py index 5be623a0f..b5bb90d19 100644 --- a/protocoloadm/migrations/0004_auto_20151007_1035.py +++ b/sapl/protocoloadm/migrations/0004_auto_20151007_1035.py @@ -3,13 +3,14 @@ from __future__ import unicode_literals from django.db import migrations, models -import protocoloadm.models +import sapl.protocoloadm.models class Migration(migrations.Migration): dependencies = [ - ('protocoloadm', '0003_documentoacessorioadministrativo_texto_integral'), + ('protocoloadm', + '0003_documentoacessorioadministrativo_texto_integral'), ] operations = [ @@ -20,6 +21,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='documentoadministrativo', name='texto_integral', - field=models.FileField(blank=True, null=True, upload_to=protocoloadm.models.texto_upload_path, verbose_name='Texto Integral'), + field=models.FileField( + blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Texto Integral'), ), ] diff --git a/protocoloadm/migrations/0005_auto_20151008_0744.py b/sapl/protocoloadm/migrations/0005_auto_20151008_0744.py similarity index 67% rename from protocoloadm/migrations/0005_auto_20151008_0744.py rename to sapl/protocoloadm/migrations/0005_auto_20151008_0744.py index 799a501e6..b52937c7f 100644 --- a/protocoloadm/migrations/0005_auto_20151008_0744.py +++ b/sapl/protocoloadm/migrations/0005_auto_20151008_0744.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import protocoloadm.models +import sapl.protocoloadm.models class Migration(migrations.Migration): @@ -16,6 +16,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='documentoacessorioadministrativo', name='arquivo', - field=models.FileField(blank=True, null=True, upload_to=protocoloadm.models.texto_upload_path, verbose_name='Arquivo'), + field=models.FileField( + blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Arquivo'), ), ] diff --git a/protocoloadm/migrations/0006_auto_20160216_1015.py b/sapl/protocoloadm/migrations/0006_auto_20160216_1015.py similarity index 100% rename from protocoloadm/migrations/0006_auto_20160216_1015.py rename to sapl/protocoloadm/migrations/0006_auto_20160216_1015.py diff --git a/protocoloadm/migrations/0007_auto_20160218_1429.py b/sapl/protocoloadm/migrations/0007_auto_20160218_1429.py similarity index 100% rename from protocoloadm/migrations/0007_auto_20160218_1429.py rename to sapl/protocoloadm/migrations/0007_auto_20160218_1429.py diff --git a/protocoloadm/migrations/0008_auto_20160308_1436.py b/sapl/protocoloadm/migrations/0008_auto_20160308_1436.py similarity index 100% rename from protocoloadm/migrations/0008_auto_20160308_1436.py rename to sapl/protocoloadm/migrations/0008_auto_20160308_1436.py diff --git a/protocoloadm/migrations/0009_auto_20160309_1323.py b/sapl/protocoloadm/migrations/0009_auto_20160309_1323.py similarity index 100% rename from protocoloadm/migrations/0009_auto_20160309_1323.py rename to sapl/protocoloadm/migrations/0009_auto_20160309_1323.py diff --git a/protocoloadm/migrations/0010_auto_20160309_1407.py b/sapl/protocoloadm/migrations/0010_auto_20160309_1407.py similarity index 100% rename from protocoloadm/migrations/0010_auto_20160309_1407.py rename to sapl/protocoloadm/migrations/0010_auto_20160309_1407.py diff --git a/protocoloadm/migrations/0011_auto_20160318_1504.py b/sapl/protocoloadm/migrations/0011_auto_20160318_1504.py similarity index 100% rename from protocoloadm/migrations/0011_auto_20160318_1504.py rename to sapl/protocoloadm/migrations/0011_auto_20160318_1504.py diff --git a/protocoloadm/migrations/0012_auto_20160503_0926.py b/sapl/protocoloadm/migrations/0012_auto_20160503_0926.py similarity index 100% rename from protocoloadm/migrations/0012_auto_20160503_0926.py rename to sapl/protocoloadm/migrations/0012_auto_20160503_0926.py diff --git a/protocoloadm/migrations/0012_tipoinstituicao.py b/sapl/protocoloadm/migrations/0012_tipoinstituicao.py similarity index 100% rename from protocoloadm/migrations/0012_tipoinstituicao.py rename to sapl/protocoloadm/migrations/0012_tipoinstituicao.py diff --git a/protocoloadm/migrations/0013_merge.py b/sapl/protocoloadm/migrations/0013_merge.py similarity index 100% rename from protocoloadm/migrations/0013_merge.py rename to sapl/protocoloadm/migrations/0013_merge.py diff --git a/parlamentares/migrations/__init__.py b/sapl/protocoloadm/migrations/__init__.py similarity index 100% rename from parlamentares/migrations/__init__.py rename to sapl/protocoloadm/migrations/__init__.py diff --git a/protocoloadm/models.py b/sapl/protocoloadm/models.py similarity index 98% rename from protocoloadm/models.py rename to sapl/protocoloadm/models.py index b85b44d0d..4d5c0b248 100644 --- a/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -4,7 +4,8 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -from materia.models import Autor, TipoMateriaLegislativa, UnidadeTramitacao +from sapl.materia.models import (Autor, TipoMateriaLegislativa, + UnidadeTramitacao) from sapl.utils import RANGE_ANOS, YES_NO_CHOICES diff --git a/protocoloadm/tests/test_protocoloadm.py b/sapl/protocoloadm/tests/test_protocoloadm.py similarity index 93% rename from protocoloadm/tests/test_protocoloadm.py rename to sapl/protocoloadm/tests/test_protocoloadm.py index 811950610..40dccb2dc 100644 --- a/protocoloadm/tests/test_protocoloadm.py +++ b/sapl/protocoloadm/tests/test_protocoloadm.py @@ -3,13 +3,13 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from model_mommy import mommy -from protocoloadm.forms import AnularProcoloAdmForm -from protocoloadm.models import Protocolo +from sapl.protocoloadm.forms import AnularProcoloAdmForm +from sapl.protocoloadm.models import Protocolo @pytest.mark.django_db(transaction=False) def test_anular_protocolo_acessivel(client): - response = client.get(reverse('protocoloadm:anular_protocolo')) + response = client.get(reverse('sapl.protocoloadm:anular_protocolo')) assert response.status_code == 200 @@ -18,7 +18,7 @@ def test_anular_protocolo_submit(client): mommy.make(Protocolo, numero='76', ano='2016', anulado=False) # TODO: setar usuario e IP - response = client.post(reverse('protocoloadm:anular_protocolo'), + response = client.post(reverse('sapl.protocoloadm:anular_protocolo'), {'numero': '76', 'ano': '2016', 'justificativa_anulacao': 'TESTE', diff --git a/protocoloadm/urls.py b/sapl/protocoloadm/urls.py similarity index 66% rename from protocoloadm/urls.py rename to sapl/protocoloadm/urls.py index ea6cad974..5f6feb538 100644 --- a/protocoloadm/urls.py +++ b/sapl/protocoloadm/urls.py @@ -1,30 +1,34 @@ from django.conf.urls import include, url -from protocoloadm.views import (AnularProtocoloAdmView, - ComprovanteProtocoloView, - CriarDocumentoProtocolo, - DetailDocumentoAdministrativo, - DocumentoAcessorioAdministrativoCrud, - DocumentoAcessorioAdministrativoEditView, - DocumentoAcessorioAdministrativoView, - DocumentoAdministrativoCrud, - PesquisarDocumentoAdministrativoView, - ProposicaoDetailView, ProposicaoReceberView, - ProposicaoView, ProposicoesIncorporadasView, - ProposicoesNaoIncorporadasView, - ProposicoesNaoRecebidasView, - ProtocoloDocumentoCrud, ProtocoloDocumentoView, - ProtocoloListView, ProtocoloMateriaCrud, - ProtocoloMateriaView, ProtocoloMostrarView, - ProtocoloPesquisaView, - StatusTramitacaoAdministrativoCrud, - TipoDocumentoAdministrativoCrud, - TipoInstituicaoCrud, TramitacaoAdmDeleteView, - TramitacaoAdmEditView, - TramitacaoAdmIncluirView, - TramitacaoAdministrativoCrud, - TramitacaoAdmView, get_nome_autor, - pesquisa_autores) +from sapl.protocoloadm.views import (AnularProtocoloAdmView, + ComprovanteProtocoloView, + CriarDocumentoProtocolo, + DetailDocumentoAdministrativo, + DocumentoAcessorioAdministrativoCrud, + DocumentoAcessorioAdministrativoEditView, + DocumentoAcessorioAdministrativoView, + DocumentoAdministrativoCrud, + PesquisarDocumentoAdministrativoView, + ProposicaoDetailView, + ProposicaoReceberView, ProposicaoView, + ProposicoesIncorporadasView, + ProposicoesNaoIncorporadasView, + ProposicoesNaoRecebidasView, + ProtocoloDocumentoCrud, + ProtocoloDocumentoView, ProtocoloListView, + ProtocoloMateriaCrud, + ProtocoloMateriaView, + ProtocoloMostrarView, + ProtocoloPesquisaView, + StatusTramitacaoAdministrativoCrud, + TipoDocumentoAdministrativoCrud, + TipoInstituicaoCrud, + TramitacaoAdmDeleteView, + TramitacaoAdmEditView, + TramitacaoAdmIncluirView, + TramitacaoAdministrativoCrud, + TramitacaoAdmView, get_nome_autor, + pesquisa_autores) from .apps import AppConfig diff --git a/protocoloadm/views.py b/sapl/protocoloadm/views.py similarity index 96% rename from protocoloadm/views.py rename to sapl/protocoloadm/views.py index 35daf35b0..3eba8b729 100644 --- a/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -12,9 +12,8 @@ from django.views.generic import CreateView, DetailView, FormView, ListView from django.views.generic.base import TemplateView from django_filters.views import FilterView -import crud.base -from crud.base import Crud, make_pagination -from materia.models import Proposicao, TipoMateriaLegislativa +from sapl.crud.base import Crud, CrudBaseMixin, CrudListView, make_pagination +from sapl.materia.models import Proposicao, TipoMateriaLegislativa from sapl.utils import create_barcode, get_client_ip from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, @@ -43,10 +42,10 @@ class StatusTramitacaoAdministrativoCrud(Crud): model = StatusTramitacaoAdministrativo help_path = '' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['sigla', 'indicador', 'descricao'] - class ListView(crud.base.CrudListView): + class ListView(CrudListView): ordering = 'sigla' @@ -91,7 +90,7 @@ class ProtocoloPesquisaView(FilterView): # Então a ordem da URL está diferente data = self.filterset.data if (data and data.get('numero') is not None): - url = "&"+str(self.request.environ['QUERY_STRING']) + url = "&" + str(self.request.environ['QUERY_STRING']) if url.startswith("&page"): ponto_comeco = url.find('numero=') - 1 url = url[ponto_comeco:] @@ -138,7 +137,7 @@ class AnularProtocoloAdmView(CreateView): form_valid_message = _('Protocolo anulado com sucesso!') def get_success_url(self): - return reverse('protocoloadm:protocolo') + return reverse('sapl.protocoloadm:protocolo') def get_initial(self): initial_data = {} @@ -164,7 +163,7 @@ class ProtocoloDocumentoView(FormValidMessageMixin, CreateView): form_valid_message = _('Protocolo cadastrado com sucesso!') def get_success_url(self): - return reverse('protocoloadm:protocolo') + return reverse('sapl.protocoloadm:protocolo') def form_valid(self, form): f = form.save(commit=False) @@ -201,7 +200,7 @@ class CriarDocumentoProtocolo(CreateView): return self.criar_documento(protocolo) def get_success_url(self): - return reverse('protocoloadm:protocolo_mostrar', + return reverse('sapl.protocoloadm:protocolo_mostrar', kwargs={'pk': self.kwargs['pk'], 'ano': self.kwargs['ano']}) @@ -275,7 +274,7 @@ class ProtocoloMateriaView(CreateView): form_valid_message = _('Matéria cadastrada com sucesso!') def get_success_url(self): - return reverse('protocoloadm:protocolo') + return reverse('sapl.protocoloadm:protocolo') def form_valid(self, form): if self.request.POST['numeracao'] == '1': @@ -461,10 +460,10 @@ class DetailDocumentoAdministrativo(DetailView): return HttpResponseRedirect(self.get_success_url()) def get_success_delete(self): - return reverse('protocoloadm:pesq_doc_adm') + return reverse('sapl.protocoloadm:pesq_doc_adm') def get_success_url(self): - return reverse('protocoloadm:detail_doc_adm', kwargs={ + return reverse('sapl.protocoloadm:detail_doc_adm', kwargs={ 'pk': self.kwargs['pk']}) @@ -512,7 +511,7 @@ class DocumentoAcessorioAdministrativoEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) + return reverse('sapl.protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class DocumentoAcessorioAdministrativoView(FormView): @@ -551,7 +550,7 @@ class DocumentoAcessorioAdministrativoView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) + return reverse('sapl.protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class TramitacaoAdmView(FormView): @@ -588,7 +587,7 @@ class TramitacaoAdmIncluirView(FormView): tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect(reverse( - 'protocoloadm:tramitacao_adm', kwargs={'pk': pk})) + 'sapl.protocoloadm:tramitacao_adm', kwargs={'pk': pk})) else: return self.form_invalid(form) @@ -615,7 +614,7 @@ class TramitacaoAdmEditView(FormView): tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect( - reverse('protocoloadm:tramitacao_adm', + reverse('sapl.protocoloadm:tramitacao_adm', kwargs={'pk': tramitacao.documento.id})) else: return self.form_invalid(form) @@ -665,7 +664,7 @@ def pesquisa_autores(request): Q(nome__icontains=q) | Q(parlamentar__nome_parlamentar__icontains=q) | Q(comissao__nome__icontains=q) - ) + ) autores = [] diff --git a/relatorios/__init__.py b/sapl/relatorios/__init__.py similarity index 100% rename from relatorios/__init__.py rename to sapl/relatorios/__init__.py diff --git a/relatorios/admin.py b/sapl/relatorios/admin.py similarity index 100% rename from relatorios/admin.py rename to sapl/relatorios/admin.py diff --git a/relatorios/apps.py b/sapl/relatorios/apps.py similarity index 73% rename from relatorios/apps.py rename to sapl/relatorios/apps.py index 3421e151a..9e560eb1c 100644 --- a/relatorios/apps.py +++ b/sapl/relatorios/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'relatorios' + name = 'sapl.relatorios' + label = 'relatorios' verbose_name = _('Relatórios') diff --git a/protocoloadm/migrations/__init__.py b/sapl/relatorios/migrations/__init__.py similarity index 100% rename from protocoloadm/migrations/__init__.py rename to sapl/relatorios/migrations/__init__.py diff --git a/relatorios/models.py b/sapl/relatorios/models.py similarity index 100% rename from relatorios/models.py rename to sapl/relatorios/models.py diff --git a/relatorios/templates/mensagem_emitir_proc.dtml b/sapl/relatorios/templates/mensagem_emitir_proc.dtml similarity index 100% rename from relatorios/templates/mensagem_emitir_proc.dtml rename to sapl/relatorios/templates/mensagem_emitir_proc.dtml diff --git a/relatorios/templates/pdf_capa_processo_gerar.py b/sapl/relatorios/templates/pdf_capa_processo_gerar.py similarity index 100% rename from relatorios/templates/pdf_capa_processo_gerar.py rename to sapl/relatorios/templates/pdf_capa_processo_gerar.py diff --git a/relatorios/templates/pdf_capa_processo_preparar_pysc.py b/sapl/relatorios/templates/pdf_capa_processo_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_capa_processo_preparar_pysc.py rename to sapl/relatorios/templates/pdf_capa_processo_preparar_pysc.py diff --git a/relatorios/templates/pdf_detalhe_materia_gerar.py b/sapl/relatorios/templates/pdf_detalhe_materia_gerar.py similarity index 100% rename from relatorios/templates/pdf_detalhe_materia_gerar.py rename to sapl/relatorios/templates/pdf_detalhe_materia_gerar.py diff --git a/relatorios/templates/pdf_detalhe_materia_preparar_pysc.py b/sapl/relatorios/templates/pdf_detalhe_materia_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_detalhe_materia_preparar_pysc.py rename to sapl/relatorios/templates/pdf_detalhe_materia_preparar_pysc.py diff --git a/relatorios/templates/pdf_documento_administrativo_gerar.py b/sapl/relatorios/templates/pdf_documento_administrativo_gerar.py similarity index 100% rename from relatorios/templates/pdf_documento_administrativo_gerar.py rename to sapl/relatorios/templates/pdf_documento_administrativo_gerar.py diff --git a/relatorios/templates/pdf_documento_administrativo_preparar_pysc.py b/sapl/relatorios/templates/pdf_documento_administrativo_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_documento_administrativo_preparar_pysc.py rename to sapl/relatorios/templates/pdf_documento_administrativo_preparar_pysc.py diff --git a/relatorios/templates/pdf_espelho_gerar.py b/sapl/relatorios/templates/pdf_espelho_gerar.py similarity index 100% rename from relatorios/templates/pdf_espelho_gerar.py rename to sapl/relatorios/templates/pdf_espelho_gerar.py diff --git a/relatorios/templates/pdf_espelho_preparar_pysc.py b/sapl/relatorios/templates/pdf_espelho_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_espelho_preparar_pysc.py rename to sapl/relatorios/templates/pdf_espelho_preparar_pysc.py diff --git a/relatorios/templates/pdf_etiqueta_protocolo_gerar.py b/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py similarity index 100% rename from relatorios/templates/pdf_etiqueta_protocolo_gerar.py rename to sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py diff --git a/relatorios/templates/pdf_etiqueta_protocolo_preparar_pysc.py b/sapl/relatorios/templates/pdf_etiqueta_protocolo_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_etiqueta_protocolo_preparar_pysc.py rename to sapl/relatorios/templates/pdf_etiqueta_protocolo_preparar_pysc.py diff --git a/relatorios/templates/pdf_materia_gerar.py b/sapl/relatorios/templates/pdf_materia_gerar.py similarity index 100% rename from relatorios/templates/pdf_materia_gerar.py rename to sapl/relatorios/templates/pdf_materia_gerar.py diff --git a/relatorios/templates/pdf_materia_preparar_pysc.py b/sapl/relatorios/templates/pdf_materia_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_materia_preparar_pysc.py rename to sapl/relatorios/templates/pdf_materia_preparar_pysc.py diff --git a/relatorios/templates/pdf_norma_gerar.py b/sapl/relatorios/templates/pdf_norma_gerar.py similarity index 100% rename from relatorios/templates/pdf_norma_gerar.py rename to sapl/relatorios/templates/pdf_norma_gerar.py diff --git a/relatorios/templates/pdf_norma_preparar_pysc.py b/sapl/relatorios/templates/pdf_norma_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_norma_preparar_pysc.py rename to sapl/relatorios/templates/pdf_norma_preparar_pysc.py diff --git a/relatorios/templates/pdf_ordem_dia_gerar.py b/sapl/relatorios/templates/pdf_ordem_dia_gerar.py similarity index 100% rename from relatorios/templates/pdf_ordem_dia_gerar.py rename to sapl/relatorios/templates/pdf_ordem_dia_gerar.py diff --git a/relatorios/templates/pdf_ordem_dia_preparar_pysc.py b/sapl/relatorios/templates/pdf_ordem_dia_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_ordem_dia_preparar_pysc.py rename to sapl/relatorios/templates/pdf_ordem_dia_preparar_pysc.py diff --git a/relatorios/templates/pdf_pauta_sessao_gerar.py b/sapl/relatorios/templates/pdf_pauta_sessao_gerar.py similarity index 100% rename from relatorios/templates/pdf_pauta_sessao_gerar.py rename to sapl/relatorios/templates/pdf_pauta_sessao_gerar.py diff --git a/relatorios/templates/pdf_pauta_sessao_preparar_pysc.py b/sapl/relatorios/templates/pdf_pauta_sessao_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_pauta_sessao_preparar_pysc.py rename to sapl/relatorios/templates/pdf_pauta_sessao_preparar_pysc.py diff --git a/relatorios/templates/pdf_protocolo_gerar.py b/sapl/relatorios/templates/pdf_protocolo_gerar.py similarity index 100% rename from relatorios/templates/pdf_protocolo_gerar.py rename to sapl/relatorios/templates/pdf_protocolo_gerar.py diff --git a/relatorios/templates/pdf_protocolo_preparar_pysc.py b/sapl/relatorios/templates/pdf_protocolo_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_protocolo_preparar_pysc.py rename to sapl/relatorios/templates/pdf_protocolo_preparar_pysc.py diff --git a/relatorios/templates/pdf_sessao_plenaria_gerar.py b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py similarity index 100% rename from relatorios/templates/pdf_sessao_plenaria_gerar.py rename to sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py diff --git a/relatorios/templates/pdf_sessao_plenaria_preparar_pysc.py b/sapl/relatorios/templates/pdf_sessao_plenaria_preparar_pysc.py similarity index 100% rename from relatorios/templates/pdf_sessao_plenaria_preparar_pysc.py rename to sapl/relatorios/templates/pdf_sessao_plenaria_preparar_pysc.py diff --git a/relatorios/tests.py b/sapl/relatorios/tests.py similarity index 100% rename from relatorios/tests.py rename to sapl/relatorios/tests.py diff --git a/relatorios/urls.py b/sapl/relatorios/urls.py similarity index 100% rename from relatorios/urls.py rename to sapl/relatorios/urls.py diff --git a/relatorios/views.py b/sapl/relatorios/views.py similarity index 97% rename from relatorios/views.py rename to sapl/relatorios/views.py index 2e3cb18ef..29b05bade 100644 --- a/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -4,19 +4,19 @@ from bs4 import BeautifulSoup from django.http import HttpResponse from django.utils.translation import ugettext_lazy as _ -from base.models import CasaLegislativa -from comissoes.models import Comissao -from materia.models import (Autor, Autoria, MateriaLegislativa, Numeracao, - Tramitacao, UnidadeTramitacao) -from parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao, - Parlamentar) -from protocoloadm.models import (DocumentoAdministrativo, Protocolo, - TramitacaoAdministrativo) +from sapl.base.models import CasaLegislativa +from sapl.comissoes.models import Comissao +from sapl.materia.models import (Autor, Autoria, MateriaLegislativa, Numeracao, + Tramitacao, UnidadeTramitacao) +from sapl.parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao, + Parlamentar) +from sapl.protocoloadm.models import (DocumentoAdministrativo, Protocolo, + TramitacaoAdministrativo) +from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, Orador, + OradorExpediente, OrdemDia, PresencaOrdemDia, + RegistroVotacao, SessaoPlenaria, + SessaoPlenariaPresenca, TipoExpediente) from sapl.utils import UF -from sessao.models import (ExpedienteMateria, ExpedienteSessao, Orador, - OradorExpediente, OrdemDia, PresencaOrdemDia, - RegistroVotacao, SessaoPlenaria, - SessaoPlenariaPresenca, TipoExpediente) from .templates import (pdf_capa_processo_gerar, pdf_documento_administrativo_gerar, pdf_espelho_gerar, @@ -338,7 +338,7 @@ def relatorio_documento_administrativo(request): response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = ( - 'inline; filename="relatorio_documento_administrativo.pdf"') + 'inline; filename="relatorio_documento_administrativo.pdf"') casa = CasaLegislativa.objects.first() diff --git a/sapl/sessao/__init__.py b/sapl/sessao/__init__.py new file mode 100644 index 000000000..c8f1364d5 --- /dev/null +++ b/sapl/sessao/__init__.py @@ -0,0 +1 @@ +default_app_config = 'sapl.sessao.apps.AppConfig' diff --git a/sessao/admin.py b/sapl/sessao/admin.py similarity index 100% rename from sessao/admin.py rename to sapl/sessao/admin.py diff --git a/sessao/apps.py b/sapl/sessao/apps.py similarity index 77% rename from sessao/apps.py rename to sapl/sessao/apps.py index a222471b8..281847b56 100644 --- a/sessao/apps.py +++ b/sapl/sessao/apps.py @@ -3,5 +3,6 @@ from django.utils.translation import ugettext_lazy as _ class AppConfig(apps.AppConfig): - name = 'sessao' + name = 'sapl.sessao' + label = 'sessao' verbose_name = _('Sessão Plenária') diff --git a/sessao/forms.py b/sapl/sessao/forms.py similarity index 96% rename from sessao/forms.py rename to sapl/sessao/forms.py index cfca3975a..83af42eb8 100644 --- a/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -8,9 +8,8 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ -import crispy_layout_mixin -from crispy_layout_mixin import form_actions -from materia.models import MateriaLegislativa, TipoMateriaLegislativa +from sapl.crispy_layout_mixin import form_actions, to_row +from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.utils import RANGE_DIAS_MES, RANGE_MESES from .models import Bancada, ExpedienteMateria, SessaoPlenaria @@ -159,7 +158,7 @@ class SessaoPlenariaFilterSet(django_filters.FilterSet): def __init__(self, *args, **kwargs): super(SessaoPlenariaFilterSet, self).__init__(*args, **kwargs) - row1 = crispy_layout_mixin.to_row( + row1 = to_row( [('data_inicio__year', 3), ('data_inicio__month', 3), ('data_inicio__day', 3), diff --git a/sessao/layouts.yaml b/sapl/sessao/layouts.yaml similarity index 100% rename from sessao/layouts.yaml rename to sapl/sessao/layouts.yaml diff --git a/sessao/legacy.yaml b/sapl/sessao/legacy.yaml similarity index 100% rename from sessao/legacy.yaml rename to sapl/sessao/legacy.yaml diff --git a/sessao/migrations/0001_initial.py b/sapl/sessao/migrations/0001_initial.py similarity index 100% rename from sessao/migrations/0001_initial.py rename to sapl/sessao/migrations/0001_initial.py diff --git a/sessao/migrations/0002_auto_20150729_1450.py b/sapl/sessao/migrations/0002_auto_20150729_1450.py similarity index 100% rename from sessao/migrations/0002_auto_20150729_1450.py rename to sapl/sessao/migrations/0002_auto_20150729_1450.py diff --git a/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py b/sapl/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py similarity index 100% rename from sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py rename to sapl/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py diff --git a/sessao/migrations/0004_auto_20150806_1614.py b/sapl/sessao/migrations/0004_auto_20150806_1614.py similarity index 74% rename from sessao/migrations/0004_auto_20150806_1614.py rename to sapl/sessao/migrations/0004_auto_20150806_1614.py index aaa5fe6c9..7785125c8 100644 --- a/sessao/migrations/0004_auto_20150806_1614.py +++ b/sapl/sessao/migrations/0004_auto_20150806_1614.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models -import sessao.models +import sapl.sessao.models class Migration(migrations.Migration): @@ -21,17 +21,20 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='expedientemateria', name='tipo_votacao', - field=models.PositiveIntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), + field=models.PositiveIntegerField(choices=[( + 1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), ), migrations.AlterField( model_name='orador', name='numero_ordem', - field=models.PositiveIntegerField(verbose_name='Ordem de pronunciamento'), + field=models.PositiveIntegerField( + verbose_name='Ordem de pronunciamento'), ), migrations.AlterField( model_name='oradorexpediente', name='numero_ordem', - field=models.PositiveIntegerField(verbose_name='Ordem de pronunciamento'), + field=models.PositiveIntegerField( + verbose_name='Ordem de pronunciamento'), ), migrations.AlterField( model_name='ordemdia', @@ -41,7 +44,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ordemdia', name='tipo_votacao', - field=models.PositiveIntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), + field=models.PositiveIntegerField(choices=[( + 1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), ), migrations.AlterField( model_name='registrovotacao', @@ -71,12 +75,14 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='sessaoplenaria', name='upload_ata', - field=models.FileField(blank=True, upload_to=sessao.models.ata_upload_path, null=True, verbose_name='Ata da Sessão'), + field=models.FileField( + blank=True, upload_to=sapl.sessao.models.ata_upload_path, null=True, verbose_name='Ata da Sessão'), ), migrations.AlterField( model_name='sessaoplenaria', name='upload_pauta', - field=models.FileField(blank=True, upload_to=sessao.models.pauta_upload_path, null=True, verbose_name='Pauta da Sessão'), + field=models.FileField( + blank=True, upload_to=sapl.sessao.models.pauta_upload_path, null=True, verbose_name='Pauta da Sessão'), ), migrations.AlterField( model_name='tiposessaoplenaria', diff --git a/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py b/sapl/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py similarity index 100% rename from sessao/migrations/0005_remove_presencaordemdia_data_ordem.py rename to sapl/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py diff --git a/sessao/migrations/0006_auto_20150929_1425.py b/sapl/sessao/migrations/0006_auto_20150929_1425.py similarity index 100% rename from sessao/migrations/0006_auto_20150929_1425.py rename to sapl/sessao/migrations/0006_auto_20150929_1425.py diff --git a/sessao/migrations/0007_auto_20150929_1426.py b/sapl/sessao/migrations/0007_auto_20150929_1426.py similarity index 100% rename from sessao/migrations/0007_auto_20150929_1426.py rename to sapl/sessao/migrations/0007_auto_20150929_1426.py diff --git a/sessao/migrations/0008_auto_20151005_0814.py b/sapl/sessao/migrations/0008_auto_20151005_0814.py similarity index 100% rename from sessao/migrations/0008_auto_20151005_0814.py rename to sapl/sessao/migrations/0008_auto_20151005_0814.py diff --git a/sessao/migrations/0009_auto_20151005_0934.py b/sapl/sessao/migrations/0009_auto_20151005_0934.py similarity index 100% rename from sessao/migrations/0009_auto_20151005_0934.py rename to sapl/sessao/migrations/0009_auto_20151005_0934.py diff --git a/sessao/migrations/0010_acompanharmateria.py b/sapl/sessao/migrations/0010_acompanharmateria.py similarity index 100% rename from sessao/migrations/0010_acompanharmateria.py rename to sapl/sessao/migrations/0010_acompanharmateria.py diff --git a/sessao/migrations/0011_auto_20160113_1239.py b/sapl/sessao/migrations/0011_auto_20160113_1239.py similarity index 100% rename from sessao/migrations/0011_auto_20160113_1239.py rename to sapl/sessao/migrations/0011_auto_20160113_1239.py diff --git a/sessao/migrations/0012_auto_20160120_1237.py b/sapl/sessao/migrations/0012_auto_20160120_1237.py similarity index 100% rename from sessao/migrations/0012_auto_20160120_1237.py rename to sapl/sessao/migrations/0012_auto_20160120_1237.py diff --git a/sessao/migrations/0013_auto_20160216_1015.py b/sapl/sessao/migrations/0013_auto_20160216_1015.py similarity index 100% rename from sessao/migrations/0013_auto_20160216_1015.py rename to sapl/sessao/migrations/0013_auto_20160216_1015.py diff --git a/sessao/migrations/0014_auto_20160223_0813.py b/sapl/sessao/migrations/0014_auto_20160223_0813.py similarity index 100% rename from sessao/migrations/0014_auto_20160223_0813.py rename to sapl/sessao/migrations/0014_auto_20160223_0813.py diff --git a/sessao/migrations/0015_auto_20160307_0918.py b/sapl/sessao/migrations/0015_auto_20160307_0918.py similarity index 100% rename from sessao/migrations/0015_auto_20160307_0918.py rename to sapl/sessao/migrations/0015_auto_20160307_0918.py diff --git a/sessao/migrations/0016_auto_20160404_1409.py b/sapl/sessao/migrations/0016_auto_20160404_1409.py similarity index 65% rename from sessao/migrations/0016_auto_20160404_1409.py rename to sapl/sessao/migrations/0016_auto_20160404_1409.py index b436d098f..88aa6a954 100644 --- a/sessao/migrations/0016_auto_20160404_1409.py +++ b/sapl/sessao/migrations/0016_auto_20160404_1409.py @@ -3,8 +3,9 @@ from __future__ import unicode_literals from django.db import migrations, models + +import sapl.sessao.models import sapl.utils -import sessao.models class Migration(migrations.Migration): @@ -17,11 +18,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='sessaoplenaria', name='upload_ata', - field=models.FileField(blank=True, null=True, upload_to=sessao.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Sessão'), + field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.ata_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Sessão'), ), migrations.AlterField( model_name='sessaoplenaria', name='upload_pauta', - field=models.FileField(blank=True, null=True, upload_to=sessao.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Sessão'), + field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.pauta_upload_path, validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Sessão'), ), ] diff --git a/sessao/migrations/0017_bancada.py b/sapl/sessao/migrations/0017_bancada.py similarity index 100% rename from sessao/migrations/0017_bancada.py rename to sapl/sessao/migrations/0017_bancada.py diff --git a/sessao/migrations/0018_auto_20160517_1435.py b/sapl/sessao/migrations/0018_auto_20160517_1435.py similarity index 100% rename from sessao/migrations/0018_auto_20160517_1435.py rename to sapl/sessao/migrations/0018_auto_20160517_1435.py diff --git a/sessao/migrations/0019_cargobancada.py b/sapl/sessao/migrations/0019_cargobancada.py similarity index 100% rename from sessao/migrations/0019_cargobancada.py rename to sapl/sessao/migrations/0019_cargobancada.py diff --git a/sessao/migrations/0020_auto_20160517_1450.py b/sapl/sessao/migrations/0020_auto_20160517_1450.py similarity index 100% rename from sessao/migrations/0020_auto_20160517_1450.py rename to sapl/sessao/migrations/0020_auto_20160517_1450.py diff --git a/relatorios/migrations/__init__.py b/sapl/sessao/migrations/__init__.py similarity index 100% rename from relatorios/migrations/__init__.py rename to sapl/sessao/migrations/__init__.py diff --git a/sessao/models.py b/sapl/sessao/models.py similarity index 97% rename from sessao/models.py rename to sapl/sessao/models.py index 249956355..14e961fdf 100644 --- a/sessao/models.py +++ b/sapl/sessao/models.py @@ -2,9 +2,9 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -from materia.models import MateriaLegislativa -from parlamentares.models import (CargoMesa, Legislatura, Parlamentar, Partido, - SessaoLegislativa) +from sapl.materia.models import MateriaLegislativa +from sapl.parlamentares.models import (CargoMesa, Legislatura, Parlamentar, + Partido, SessaoLegislativa) from sapl.utils import YES_NO_CHOICES, restringe_tipos_de_arquivo_txt @@ -60,7 +60,7 @@ class TipoSessaoPlenaria(models.Model): def get_sessao_media_path(instance, subpath, filename): - return './sessao/%s/%s/%s' % (instance.numero, subpath, filename) + return './sapl/sessao/%s/%s/%s' % (instance.numero, subpath, filename) def pauta_upload_path(instance, filename): diff --git a/sessao/serializers.py b/sapl/sessao/serializers.py similarity index 100% rename from sessao/serializers.py rename to sapl/sessao/serializers.py diff --git a/sessao/urls.py b/sapl/sessao/urls.py similarity index 75% rename from sessao/urls.py rename to sapl/sessao/urls.py index d075a7e13..f616e00a2 100644 --- a/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -2,23 +2,25 @@ from django.conf.urls import include, url from django.views.static import serve from sapl import settings -from sessao.views import (BancadaCrud, CargoBancadaCrud, - EditMateriaOrdemDiaView, ExpedienteMateriaCrud, - ExpedienteView, ListMateriaOrdemDiaView, - MateriaOrdemDiaView, MesaView, OradorCrud, - OradorExpedienteCrud, PainelView, - PautaExpedienteDetail, PautaOrdemDetail, - PautaSessaoDetailView, PautaSessaoListView, - PesquisarSessaoPlenariaView, PresencaOrdemDiaView, - PresencaView, ResumoView, SessaoCrud, - SessaoPlenariaView, TipoExpedienteCrud, - TipoResultadoVotacaoCrud, TipoSessaoCrud, - VotacaoEditView, VotacaoExpedienteEditView, - VotacaoExpedienteView, VotacaoNominalEditView, - VotacaoNominalExpedienteEditView, - VotacaoNominalExpedienteView, VotacaoNominalView, - VotacaoView, abrir_votacao_view, - reordernar_materias_expediente) +from sapl.sessao.views import (BancadaCrud, CargoBancadaCrud, + EditMateriaOrdemDiaView, ExpedienteMateriaCrud, + ExpedienteView, ListMateriaOrdemDiaView, + MateriaOrdemDiaView, MesaView, OradorCrud, + OradorExpedienteCrud, PainelView, + PautaExpedienteDetail, PautaOrdemDetail, + PautaSessaoDetailView, PautaSessaoListView, + PesquisarSessaoPlenariaView, + PresencaOrdemDiaView, PresencaView, ResumoView, + SessaoCrud, SessaoPlenariaView, + TipoExpedienteCrud, TipoResultadoVotacaoCrud, + TipoSessaoCrud, VotacaoEditView, + VotacaoExpedienteEditView, + VotacaoExpedienteView, VotacaoNominalEditView, + VotacaoNominalExpedienteEditView, + VotacaoNominalExpedienteView, + VotacaoNominalView, VotacaoView, + abrir_votacao_view, + reordernar_materias_expediente) from .apps import AppConfig @@ -30,7 +32,8 @@ sessao_rest = [ urlpatterns = [ url(r'^sessao/', include(SessaoCrud.get_urls() + OradorCrud.get_urls() + - OradorExpedienteCrud.get_urls() + ExpedienteMateriaCrud.get_urls())), + OradorExpedienteCrud.get_urls() + + ExpedienteMateriaCrud.get_urls())), url(r'^(?P\d+)/(?P\d+)/abrir-votacao$', abrir_votacao_view, name="abrir_votacao"), diff --git a/sessao/views.py b/sapl/sessao/views.py similarity index 94% rename from sessao/views.py rename to sapl/sessao/views.py index 680d72369..7cdb90d2a 100644 --- a/sessao/views.py +++ b/sapl/sessao/views.py @@ -13,15 +13,15 @@ from django.views.generic.edit import FormMixin from django_filters.views import FilterView from rest_framework import generics -import crud.base -import crud.masterdetail -from crud.base import Crud, make_pagination -from crud.masterdetail import MasterDetailCrud -from materia.models import (Autoria, DocumentoAcessorio, - TipoMateriaLegislativa, Tramitacao) -from norma.models import NormaJuridica -from parlamentares.models import Parlamentar -from sessao.serializers import SessaoPlenariaSerializer +from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, + CrudDetailView, CrudListView, CrudUpdateView, + make_pagination) +from sapl.crud.masterdetail import MasterDetailCrud +from sapl.materia.models import (Autoria, DocumentoAcessorio, + TipoMateriaLegislativa, Tramitacao) +from sapl.norma.models import NormaJuridica +from sapl.parlamentares.models import Parlamentar +from sapl.sessao.serializers import SessaoPlenariaSerializer from .forms import (BancadaForm, ExpedienteForm, ExpedienteMateriaForm, ListMateriaForm, MateriaOrdemDiaForm, MesaForm, @@ -45,7 +45,7 @@ CargoBancadaCrud = Crud.build(CargoBancada, '') def reordernar_materias_expediente(request, pk): expedientes = ExpedienteMateria.objects.filter( - sessao_plenaria_id=pk) + sessao_plenaria_id=pk) exp_num = 1 for e in expedientes: e.numero_ordem = exp_num @@ -53,30 +53,30 @@ def reordernar_materias_expediente(request, pk): exp_num += 1 return HttpResponseRedirect( - reverse('sessao:expedientemateria_list', kwargs={'pk': pk})) + reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk})) class BancadaCrud(Crud): model = Bancada help_path = '' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['nome', 'legislatura'] - class ListView(crud.base.CrudListView): + class ListView(CrudListView): ordering = 'legislatura' - class CreateView(crud.base.CrudCreateView): + class CreateView(CrudCreateView): form_class = BancadaForm - class UpdateView(crud.base.CrudUpdateView): + class UpdateView(CrudUpdateView): form_class = BancadaForm def abrir_votacao_view(request, pk, spk): existe_votacao_aberta = ExpedienteMateria.objects.filter( - sessao_plenaria_id=spk, votacao_aberta=True - ).exists() + sessao_plenaria_id=spk, votacao_aberta=True + ).exists() if existe_votacao_aberta: msg = _('Já existe uma matéria com votação aberta. Para abrir ' 'outra, termine ou feche a votação existente.') @@ -86,7 +86,7 @@ def abrir_votacao_view(request, pk, spk): expediente.votacao_aberta = True expediente.save() return HttpResponseRedirect( - reverse('sessao:expedientemateria_list', kwargs={'pk': spk})) + reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': spk})) class ExpedienteMateriaCrud(MasterDetailCrud): @@ -107,23 +107,23 @@ class ExpedienteMateriaCrud(MasterDetailCrud): if obj.votacao_aberta: url = '' if obj.tipo_votacao == 1: - url = reverse('sessao:votacaosimbolicaexp', + url = reverse('sapl.sessao:votacaosimbolicaexp', kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) elif obj.tipo_votacao == 2: - url = reverse('sessao:votacaonominalexp', - kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + url = reverse('sapl.sessao:votacaonominalexp', + kwargs={ + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) elif obj.tipo_votacao == 3: - url = reverse('sessao:votacaosecretaexp', + url = reverse('sapl.sessao:votacaosecretaexp', kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) btn_registrar = ''' Registrar Votação''' % (url) obj.resultado = btn_registrar else: - url = reverse('sessao:abrir_votacao', kwargs={ + url = reverse('sapl.sessao:abrir_votacao', kwargs={ 'pk': obj.pk, 'spk': obj.sessao_plenaria_id}) btn_abrir = ''' Matéria não votada
@@ -142,23 +142,23 @@ class ExpedienteMateriaCrud(MasterDetailCrud): else: url = '' if obj.tipo_votacao == 1: - url = reverse('sessao:votacaosimbolicaexpedit', + url = reverse('sapl.sessao:votacaosimbolicaexpedit', kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) elif obj.tipo_votacao == 2: - url = reverse('sessao:votacaonominalexpedit', - kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + url = reverse('sapl.sessao:votacaonominalexpedit', + kwargs={ + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) elif obj.tipo_votacao == 3: - url = reverse('sessao:votacaosecretaexpedit', + url = reverse('sapl.sessao:votacaosecretaexpedit', kwargs={ - 'pk': obj.sessao_plenaria_id, - 'oid': obj.materia_id, - 'mid': obj.pk}) + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) obj.resultado = '%s' % (url, obj.resultado) return [self._as_row(obj) for obj in object_list] @@ -203,17 +203,17 @@ class SessaoCrud(Crud): model = SessaoPlenaria help_path = 'sessao_plenaria' - class BaseMixin(crud.base.CrudBaseMixin): + class BaseMixin(CrudBaseMixin): list_field_names = ['data_inicio', 'legislatura', 'sessao_legislativa', 'tipo'] # FIXME!!!! corrigir referencias no codigo e remover isso!!!!! # fazer com #230 - class CrudDetailView(crud.base.CrudDetailView): + class CrudDetailView(CrudDetailView): model = SessaoPlenaria help_path = 'sessao_plenaria' - class ListView(crud.base.CrudListView): + class ListView(CrudListView): ordering = ['-data_inicio'] @@ -272,7 +272,7 @@ class PresencaView(FormMixin, PresencaMixin, SessaoCrud.DetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:presenca', kwargs={'pk': pk}) + return reverse('sapl.sessao:presenca', kwargs={'pk': pk}) class PainelView(TemplateView): @@ -321,7 +321,7 @@ class PresencaOrdemDiaView(FormMixin, def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:presencaordemdia', kwargs={'pk': pk}) + return reverse('sapl.sessao:presencaordemdia', kwargs={'pk': pk}) class ListMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): @@ -487,7 +487,7 @@ class MateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -598,7 +598,7 @@ class EditMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -693,7 +693,7 @@ class MesaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:mesa', kwargs={'pk': pk}) + return reverse('sapl.sessao:mesa', kwargs={'pk': pk}) class ResumoView(SessaoCrud.CrudDetailView): @@ -933,7 +933,7 @@ class ExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:expediente', kwargs={'pk': pk}) + return reverse('sapl.sessao:expediente', kwargs={'pk': pk}) class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView): @@ -1005,7 +1005,7 @@ class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1124,7 +1124,7 @@ class VotacaoView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1251,7 +1251,7 @@ class VotacaoNominalView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1328,7 +1328,7 @@ class VotacaoNominalEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:materiaordemdia_list', + return reverse('sapl.sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1453,7 +1453,7 @@ class VotacaoNominalExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:expedientemateria_list', + return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk}) @@ -1530,7 +1530,7 @@ class VotacaoNominalExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:expedientemateria_list', + return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk}) @@ -1651,7 +1651,7 @@ class VotacaoExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:expedientemateria_list', + return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk}) @@ -1666,7 +1666,7 @@ class VotacaoExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessao:expedientemateria_list', + return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk}) def get_tipos_votacao(self): diff --git a/sapl/settings.py b/sapl/settings.py index 620ebaacb..96dee01eb 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -8,6 +8,10 @@ https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ + +Quick-start development settings - unsuitable for production +See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + """ from decouple import config from dj_database_url import parse as db_url @@ -16,14 +20,12 @@ from unipath import Path from .temp_suppress_crispy_form_warnings import \ SUPRESS_CRISPY_FORM_WARNINGS_LOGGING -BASE_DIR = Path(__file__).ancestor(2) - +BASE_DIR = Path(__file__).ancestor(1) +PROJECT_DIR = Path(__file__).ancestor(2) -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = config('SECRET_KEY') +SECRET_KEY = config('SECRET_KEY', default='') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=False, cast=bool) @@ -35,16 +37,16 @@ LOGIN_URL = '/login/?next=' # SAPL business apps in dependency order SAPL_APPS = ( - 'base', - 'parlamentares', - 'comissoes', - 'materia', - 'norma', - 'sessao', - 'lexml', - 'painel', - 'protocoloadm', - 'compilacao', + 'sapl.base', + 'sapl.parlamentares', + 'sapl.comissoes', + 'sapl.materia', + 'sapl.norma', + 'sapl.sessao', + 'sapl.lexml', + 'sapl.painel', + 'sapl.protocoloadm', + 'sapl.compilacao', ) INSTALLED_APPS = ( @@ -88,7 +90,7 @@ ROOT_URLCONF = 'sapl.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': ['templates'], + 'DIRS': ['sapl/templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -113,7 +115,7 @@ WSGI_APPLICATION = 'sapl.wsgi.application' DATABASES = { 'default': config( - 'DATABASE_URL', + 'DATABASE_URL', default='sqlite://:memory:', cast=db_url, ) } @@ -122,11 +124,11 @@ DATABASES = { # https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#substituting-a-custom-user-model AUTH_USER_MODEL = 'auth.User' -EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool) -EMAIL_HOST = config('EMAIL_HOST', cast=str) -EMAIL_HOST_USER = config('EMAIL_HOST_USER', cast=str) -EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', cast=str) -EMAIL_PORT = config('EMAIL_PORT', cast=int) +EMAIL_HOST = config('EMAIL_HOST', default='localhost') +EMAIL_PORT = config('EMAIL_PORT', cast=int, default=587) +EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='') +EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='') +EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool, default=True) MAX_DOC_UPLOAD_SIZE = 5 * 1024 * 1024 # 5MB MAX_IMAGE_UPLOAD_SIZE = 2 * 1024 * 1024 # 2MB @@ -154,7 +156,7 @@ LOCALE_PATHS = ( # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' -STATIC_ROOT = BASE_DIR.child("collected_static") +STATIC_ROOT = PROJECT_DIR.child("collected_static") STATICFILES_DIRS = (BASE_DIR.child("static"),) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', @@ -163,7 +165,7 @@ STATICFILES_FINDERS = ( 'sass_processor.finders.CssFinder', ) -MEDIA_ROOT = BASE_DIR.child("media") +MEDIA_ROOT = PROJECT_DIR.child("media") MEDIA_URL = '/media/' DAB_FIELD_RENDERER = \ @@ -172,7 +174,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3' CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap3' CRISPY_FAIL_SILENTLY = not DEBUG -BOWER_COMPONENTS_ROOT = BASE_DIR.child("bower") +BOWER_COMPONENTS_ROOT = PROJECT_DIR.child("bower") BOWER_INSTALLED_APPS = ( 'bootstrap-sass#3.3.6', 'components-font-awesome#4.5.0', diff --git a/static/audio/ring.mp3 b/sapl/static/audio/ring.mp3 similarity index 100% rename from static/audio/ring.mp3 rename to sapl/static/audio/ring.mp3 diff --git a/static/img/arrow.png b/sapl/static/img/arrow.png similarity index 100% rename from static/img/arrow.png rename to sapl/static/img/arrow.png diff --git a/static/img/brasao_transp.gif b/sapl/static/img/brasao_transp.gif similarity index 100% rename from static/img/brasao_transp.gif rename to sapl/static/img/brasao_transp.gif diff --git a/static/img/down_arrow_select.jpg b/sapl/static/img/down_arrow_select.jpg similarity index 100% rename from static/img/down_arrow_select.jpg rename to sapl/static/img/down_arrow_select.jpg diff --git a/static/img/etiqueta.png b/sapl/static/img/etiqueta.png similarity index 100% rename from static/img/etiqueta.png rename to sapl/static/img/etiqueta.png diff --git a/static/img/favicon.ico b/sapl/static/img/favicon.ico similarity index 100% rename from static/img/favicon.ico rename to sapl/static/img/favicon.ico diff --git a/static/img/hand-note.png b/sapl/static/img/hand-note.png similarity index 100% rename from static/img/hand-note.png rename to sapl/static/img/hand-note.png diff --git a/static/img/icon_delete_white.png b/sapl/static/img/icon_delete_white.png similarity index 100% rename from static/img/icon_delete_white.png rename to sapl/static/img/icon_delete_white.png diff --git a/static/img/icon_save_white.png b/sapl/static/img/icon_save_white.png similarity index 100% rename from static/img/icon_save_white.png rename to sapl/static/img/icon_save_white.png diff --git a/static/img/lexml.gif b/sapl/static/img/lexml.gif similarity index 100% rename from static/img/lexml.gif rename to sapl/static/img/lexml.gif diff --git a/static/img/logo.png b/sapl/static/img/logo.png similarity index 100% rename from static/img/logo.png rename to sapl/static/img/logo.png diff --git a/static/img/logo_cc.png b/sapl/static/img/logo_cc.png similarity index 100% rename from static/img/logo_cc.png rename to sapl/static/img/logo_cc.png diff --git a/static/img/logo_interlegis.png b/sapl/static/img/logo_interlegis.png similarity index 100% rename from static/img/logo_interlegis.png rename to sapl/static/img/logo_interlegis.png diff --git a/static/img/manual.png b/sapl/static/img/manual.png similarity index 100% rename from static/img/manual.png rename to sapl/static/img/manual.png diff --git a/static/img/perfil.png b/sapl/static/img/perfil.png similarity index 100% rename from static/img/perfil.png rename to sapl/static/img/perfil.png diff --git a/static/img/search-gray.png b/sapl/static/img/search-gray.png similarity index 100% rename from static/img/search-gray.png rename to sapl/static/img/search-gray.png diff --git a/static/img/search.png b/sapl/static/img/search.png similarity index 100% rename from static/img/search.png rename to sapl/static/img/search.png diff --git a/static/img/user.png b/sapl/static/img/user.png similarity index 100% rename from static/img/user.png rename to sapl/static/img/user.png diff --git a/static/js/app.js b/sapl/static/js/app.js similarity index 100% rename from static/js/app.js rename to sapl/static/js/app.js diff --git a/static/js/compilacao.js b/sapl/static/js/compilacao.js similarity index 100% rename from static/js/compilacao.js rename to sapl/static/js/compilacao.js diff --git a/static/js/compilacao_edit.js b/sapl/static/js/compilacao_edit.js similarity index 100% rename from static/js/compilacao_edit.js rename to sapl/static/js/compilacao_edit.js diff --git a/static/js/compilacao_notas.js b/sapl/static/js/compilacao_notas.js similarity index 100% rename from static/js/compilacao_notas.js rename to sapl/static/js/compilacao_notas.js diff --git a/static/js/compilacao_view.js b/sapl/static/js/compilacao_view.js similarity index 100% rename from static/js/compilacao_view.js rename to sapl/static/js/compilacao_view.js diff --git a/static/styles/_header.scss b/sapl/static/styles/_header.scss similarity index 100% rename from static/styles/_header.scss rename to sapl/static/styles/_header.scss diff --git a/static/styles/app.scss b/sapl/static/styles/app.scss similarity index 100% rename from static/styles/app.scss rename to sapl/static/styles/app.scss diff --git a/static/styles/compilacao.scss b/sapl/static/styles/compilacao.scss similarity index 100% rename from static/styles/compilacao.scss rename to sapl/static/styles/compilacao.scss diff --git a/static/styles/style_tinymce.css b/sapl/static/styles/style_tinymce.css similarity index 100% rename from static/styles/style_tinymce.css rename to sapl/static/styles/style_tinymce.css diff --git a/templates/ajuda/acessando_alimenta.html b/sapl/templates/ajuda/acessando_alimenta.html similarity index 100% rename from templates/ajuda/acessando_alimenta.html rename to sapl/templates/ajuda/acessando_alimenta.html diff --git a/templates/ajuda/acomp_materia.html b/sapl/templates/ajuda/acomp_materia.html similarity index 100% rename from templates/ajuda/acomp_materia.html rename to sapl/templates/ajuda/acomp_materia.html diff --git a/templates/ajuda/anexos.html b/sapl/templates/ajuda/anexos.html similarity index 100% rename from templates/ajuda/anexos.html rename to sapl/templates/ajuda/anexos.html diff --git a/templates/ajuda/autor.html b/sapl/templates/ajuda/autor.html similarity index 100% rename from templates/ajuda/autor.html rename to sapl/templates/ajuda/autor.html diff --git a/templates/ajuda/cadastro_comissoes.html b/sapl/templates/ajuda/cadastro_comissoes.html similarity index 100% rename from templates/ajuda/cadastro_comissoes.html rename to sapl/templates/ajuda/cadastro_comissoes.html diff --git a/templates/ajuda/cadastro_materia.html b/sapl/templates/ajuda/cadastro_materia.html similarity index 100% rename from templates/ajuda/cadastro_materia.html rename to sapl/templates/ajuda/cadastro_materia.html diff --git a/templates/ajuda/cadastro_mesa_diretora.html b/sapl/templates/ajuda/cadastro_mesa_diretora.html similarity index 100% rename from templates/ajuda/cadastro_mesa_diretora.html rename to sapl/templates/ajuda/cadastro_mesa_diretora.html diff --git a/templates/ajuda/cadastro_parlamentares.html b/sapl/templates/ajuda/cadastro_parlamentares.html similarity index 100% rename from templates/ajuda/cadastro_parlamentares.html rename to sapl/templates/ajuda/cadastro_parlamentares.html diff --git a/templates/ajuda/cargo_comissao.html b/sapl/templates/ajuda/cargo_comissao.html similarity index 100% rename from templates/ajuda/cargo_comissao.html rename to sapl/templates/ajuda/cargo_comissao.html diff --git a/templates/ajuda/cargo_mesa.html b/sapl/templates/ajuda/cargo_mesa.html similarity index 100% rename from templates/ajuda/cargo_mesa.html rename to sapl/templates/ajuda/cargo_mesa.html diff --git a/templates/ajuda/casa_legislativa.html b/sapl/templates/ajuda/casa_legislativa.html similarity index 100% rename from templates/ajuda/casa_legislativa.html rename to sapl/templates/ajuda/casa_legislativa.html diff --git a/templates/ajuda/coligacao.html b/sapl/templates/ajuda/coligacao.html similarity index 100% rename from templates/ajuda/coligacao.html rename to sapl/templates/ajuda/coligacao.html diff --git a/templates/ajuda/consultas.html b/sapl/templates/ajuda/consultas.html similarity index 100% rename from templates/ajuda/consultas.html rename to sapl/templates/ajuda/consultas.html diff --git a/templates/ajuda/dependentes.html b/sapl/templates/ajuda/dependentes.html similarity index 100% rename from templates/ajuda/dependentes.html rename to sapl/templates/ajuda/dependentes.html diff --git a/templates/ajuda/despacho_autoria.html b/sapl/templates/ajuda/despacho_autoria.html similarity index 100% rename from templates/ajuda/despacho_autoria.html rename to sapl/templates/ajuda/despacho_autoria.html diff --git a/templates/ajuda/envio_proposicao.html b/sapl/templates/ajuda/envio_proposicao.html similarity index 100% rename from templates/ajuda/envio_proposicao.html rename to sapl/templates/ajuda/envio_proposicao.html diff --git a/templates/ajuda/filiacoes_partidarias.html b/sapl/templates/ajuda/filiacoes_partidarias.html similarity index 100% rename from templates/ajuda/filiacoes_partidarias.html rename to sapl/templates/ajuda/filiacoes_partidarias.html diff --git a/templates/ajuda/fim_relatoria.html b/sapl/templates/ajuda/fim_relatoria.html similarity index 100% rename from templates/ajuda/fim_relatoria.html rename to sapl/templates/ajuda/fim_relatoria.html diff --git a/templates/ajuda/gerenciamento_usuarios.html b/sapl/templates/ajuda/gerenciamento_usuarios.html similarity index 100% rename from templates/ajuda/gerenciamento_usuarios.html rename to sapl/templates/ajuda/gerenciamento_usuarios.html diff --git a/templates/ajuda/glossario.html b/sapl/templates/ajuda/glossario.html similarity index 100% rename from templates/ajuda/glossario.html rename to sapl/templates/ajuda/glossario.html diff --git a/templates/ajuda/impressos.html b/sapl/templates/ajuda/impressos.html similarity index 100% rename from templates/ajuda/impressos.html rename to sapl/templates/ajuda/impressos.html diff --git a/templates/ajuda/index.html b/sapl/templates/ajuda/index.html similarity index 100% rename from templates/ajuda/index.html rename to sapl/templates/ajuda/index.html diff --git a/templates/ajuda/legislacao_cita_matanexada.html b/sapl/templates/ajuda/legislacao_cita_matanexada.html similarity index 100% rename from templates/ajuda/legislacao_cita_matanexada.html rename to sapl/templates/ajuda/legislacao_cita_matanexada.html diff --git a/templates/ajuda/legislatura.html b/sapl/templates/ajuda/legislatura.html similarity index 100% rename from templates/ajuda/legislatura.html rename to sapl/templates/ajuda/legislatura.html diff --git a/templates/ajuda/lexml.html b/sapl/templates/ajuda/lexml.html similarity index 100% rename from templates/ajuda/lexml.html rename to sapl/templates/ajuda/lexml.html diff --git a/templates/ajuda/mandatos_parlamentar.html b/sapl/templates/ajuda/mandatos_parlamentar.html similarity index 100% rename from templates/ajuda/mandatos_parlamentar.html rename to sapl/templates/ajuda/mandatos_parlamentar.html diff --git a/templates/ajuda/materia_anexada.html b/sapl/templates/ajuda/materia_anexada.html similarity index 100% rename from templates/ajuda/materia_anexada.html rename to sapl/templates/ajuda/materia_anexada.html diff --git a/templates/ajuda/modulo_comissoes.html b/sapl/templates/ajuda/modulo_comissoes.html similarity index 100% rename from templates/ajuda/modulo_comissoes.html rename to sapl/templates/ajuda/modulo_comissoes.html diff --git a/templates/ajuda/modulo_mesa_diretora.html b/sapl/templates/ajuda/modulo_mesa_diretora.html similarity index 100% rename from templates/ajuda/modulo_mesa_diretora.html rename to sapl/templates/ajuda/modulo_mesa_diretora.html diff --git a/templates/ajuda/modulo_norma_juridica.html b/sapl/templates/ajuda/modulo_norma_juridica.html similarity index 100% rename from templates/ajuda/modulo_norma_juridica.html rename to sapl/templates/ajuda/modulo_norma_juridica.html diff --git a/templates/ajuda/modulo_parlamentares.html b/sapl/templates/ajuda/modulo_parlamentares.html similarity index 100% rename from templates/ajuda/modulo_parlamentares.html rename to sapl/templates/ajuda/modulo_parlamentares.html diff --git a/templates/ajuda/modulo_tramitacao_materias.html b/sapl/templates/ajuda/modulo_tramitacao_materias.html similarity index 100% rename from templates/ajuda/modulo_tramitacao_materias.html rename to sapl/templates/ajuda/modulo_tramitacao_materias.html diff --git a/templates/ajuda/nivel_instrucao.html b/sapl/templates/ajuda/nivel_instrucao.html similarity index 100% rename from templates/ajuda/nivel_instrucao.html rename to sapl/templates/ajuda/nivel_instrucao.html diff --git a/templates/ajuda/norma_juridica.html b/sapl/templates/ajuda/norma_juridica.html similarity index 100% rename from templates/ajuda/norma_juridica.html rename to sapl/templates/ajuda/norma_juridica.html diff --git a/templates/ajuda/numeracao_docsacess.html b/sapl/templates/ajuda/numeracao_docsacess.html similarity index 100% rename from templates/ajuda/numeracao_docsacess.html rename to sapl/templates/ajuda/numeracao_docsacess.html diff --git a/templates/ajuda/ordem_dia.html b/sapl/templates/ajuda/ordem_dia.html similarity index 100% rename from templates/ajuda/ordem_dia.html rename to sapl/templates/ajuda/ordem_dia.html diff --git a/templates/ajuda/orgao.html b/sapl/templates/ajuda/orgao.html similarity index 100% rename from templates/ajuda/orgao.html rename to sapl/templates/ajuda/orgao.html diff --git a/templates/ajuda/origem.html b/sapl/templates/ajuda/origem.html similarity index 100% rename from templates/ajuda/origem.html rename to sapl/templates/ajuda/origem.html diff --git a/templates/ajuda/partidos.html b/sapl/templates/ajuda/partidos.html similarity index 100% rename from templates/ajuda/partidos.html rename to sapl/templates/ajuda/partidos.html diff --git a/templates/ajuda/periodo_composicao_comissao.html b/sapl/templates/ajuda/periodo_composicao_comissao.html similarity index 100% rename from templates/ajuda/periodo_composicao_comissao.html rename to sapl/templates/ajuda/periodo_composicao_comissao.html diff --git a/templates/ajuda/proposicao.html b/sapl/templates/ajuda/proposicao.html similarity index 100% rename from templates/ajuda/proposicao.html rename to sapl/templates/ajuda/proposicao.html diff --git a/templates/ajuda/proposicao_editor.html b/sapl/templates/ajuda/proposicao_editor.html similarity index 100% rename from templates/ajuda/proposicao_editor.html rename to sapl/templates/ajuda/proposicao_editor.html diff --git a/templates/ajuda/proposicao_legislativa.html b/sapl/templates/ajuda/proposicao_legislativa.html similarity index 100% rename from templates/ajuda/proposicao_legislativa.html rename to sapl/templates/ajuda/proposicao_legislativa.html diff --git a/templates/ajuda/protocolo_administrativo.html b/sapl/templates/ajuda/protocolo_administrativo.html similarity index 100% rename from templates/ajuda/protocolo_administrativo.html rename to sapl/templates/ajuda/protocolo_administrativo.html diff --git a/templates/ajuda/protocolo_anular.html b/sapl/templates/ajuda/protocolo_anular.html similarity index 100% rename from templates/ajuda/protocolo_anular.html rename to sapl/templates/ajuda/protocolo_anular.html diff --git a/templates/ajuda/protocolo_geral.html b/sapl/templates/ajuda/protocolo_geral.html similarity index 100% rename from templates/ajuda/protocolo_geral.html rename to sapl/templates/ajuda/protocolo_geral.html diff --git a/templates/ajuda/protocolo_gerar_etiqueta_processo.html b/sapl/templates/ajuda/protocolo_gerar_etiqueta_processo.html similarity index 100% rename from templates/ajuda/protocolo_gerar_etiqueta_processo.html rename to sapl/templates/ajuda/protocolo_gerar_etiqueta_processo.html diff --git a/templates/ajuda/protocolo_gerar_etiqueta_protocolo.html b/sapl/templates/ajuda/protocolo_gerar_etiqueta_protocolo.html similarity index 100% rename from templates/ajuda/protocolo_gerar_etiqueta_protocolo.html rename to sapl/templates/ajuda/protocolo_gerar_etiqueta_protocolo.html diff --git a/templates/ajuda/protocolo_legislativo.html b/sapl/templates/ajuda/protocolo_legislativo.html similarity index 100% rename from templates/ajuda/protocolo_legislativo.html rename to sapl/templates/ajuda/protocolo_legislativo.html diff --git a/templates/ajuda/recebimento_proposicao.html b/sapl/templates/ajuda/recebimento_proposicao.html similarity index 100% rename from templates/ajuda/recebimento_proposicao.html rename to sapl/templates/ajuda/recebimento_proposicao.html diff --git a/templates/ajuda/regime_tramitacao.html b/sapl/templates/ajuda/regime_tramitacao.html similarity index 100% rename from templates/ajuda/regime_tramitacao.html rename to sapl/templates/ajuda/regime_tramitacao.html diff --git a/templates/ajuda/relatorios.html b/sapl/templates/ajuda/relatorios.html similarity index 100% rename from templates/ajuda/relatorios.html rename to sapl/templates/ajuda/relatorios.html diff --git a/templates/ajuda/sessao_legislativa.html b/sapl/templates/ajuda/sessao_legislativa.html similarity index 100% rename from templates/ajuda/sessao_legislativa.html rename to sapl/templates/ajuda/sessao_legislativa.html diff --git a/templates/ajuda/sessao_plenaria.html b/sapl/templates/ajuda/sessao_plenaria.html similarity index 100% rename from templates/ajuda/sessao_plenaria.html rename to sapl/templates/ajuda/sessao_plenaria.html diff --git a/templates/ajuda/sessao_plenaria_ata.html b/sapl/templates/ajuda/sessao_plenaria_ata.html similarity index 100% rename from templates/ajuda/sessao_plenaria_ata.html rename to sapl/templates/ajuda/sessao_plenaria_ata.html diff --git a/templates/ajuda/sessao_plenaria_expedientes.html b/sapl/templates/ajuda/sessao_plenaria_expedientes.html similarity index 100% rename from templates/ajuda/sessao_plenaria_expedientes.html rename to sapl/templates/ajuda/sessao_plenaria_expedientes.html diff --git a/templates/ajuda/sessao_plenaria_lista_presenca_sessao.html b/sapl/templates/ajuda/sessao_plenaria_lista_presenca_sessao.html similarity index 100% rename from templates/ajuda/sessao_plenaria_lista_presenca_sessao.html rename to sapl/templates/ajuda/sessao_plenaria_lista_presenca_sessao.html diff --git a/templates/ajuda/sessao_plenaria_materias_expediente.html b/sapl/templates/ajuda/sessao_plenaria_materias_expediente.html similarity index 100% rename from templates/ajuda/sessao_plenaria_materias_expediente.html rename to sapl/templates/ajuda/sessao_plenaria_materias_expediente.html diff --git a/templates/ajuda/sessao_plenaria_materias_ordem_dia.html b/sapl/templates/ajuda/sessao_plenaria_materias_ordem_dia.html similarity index 100% rename from templates/ajuda/sessao_plenaria_materias_ordem_dia.html rename to sapl/templates/ajuda/sessao_plenaria_materias_ordem_dia.html diff --git a/templates/ajuda/sessao_plenaria_mesa.html b/sapl/templates/ajuda/sessao_plenaria_mesa.html similarity index 100% rename from templates/ajuda/sessao_plenaria_mesa.html rename to sapl/templates/ajuda/sessao_plenaria_mesa.html diff --git a/templates/ajuda/sessao_plenaria_oradores.html b/sapl/templates/ajuda/sessao_plenaria_oradores.html similarity index 100% rename from templates/ajuda/sessao_plenaria_oradores.html rename to sapl/templates/ajuda/sessao_plenaria_oradores.html diff --git a/templates/ajuda/sessao_plenaria_oradores_expediente.html b/sapl/templates/ajuda/sessao_plenaria_oradores_expediente.html similarity index 100% rename from templates/ajuda/sessao_plenaria_oradores_expediente.html rename to sapl/templates/ajuda/sessao_plenaria_oradores_expediente.html diff --git a/templates/ajuda/sessao_plenaria_oradores_explicacoes_pessoais.html b/sapl/templates/ajuda/sessao_plenaria_oradores_explicacoes_pessoais.html similarity index 100% rename from templates/ajuda/sessao_plenaria_oradores_explicacoes_pessoais.html rename to sapl/templates/ajuda/sessao_plenaria_oradores_explicacoes_pessoais.html diff --git a/templates/ajuda/sessao_plenaria_presenca_ordem_dia.html b/sapl/templates/ajuda/sessao_plenaria_presenca_ordem_dia.html similarity index 100% rename from templates/ajuda/sessao_plenaria_presenca_ordem_dia.html rename to sapl/templates/ajuda/sessao_plenaria_presenca_ordem_dia.html diff --git a/templates/ajuda/sessao_plenaria_votacao.html b/sapl/templates/ajuda/sessao_plenaria_votacao.html similarity index 100% rename from templates/ajuda/sessao_plenaria_votacao.html rename to sapl/templates/ajuda/sessao_plenaria_votacao.html diff --git a/templates/ajuda/status_tramitacao.html b/sapl/templates/ajuda/status_tramitacao.html similarity index 100% rename from templates/ajuda/status_tramitacao.html rename to sapl/templates/ajuda/status_tramitacao.html diff --git a/templates/ajuda/tipo_afastamento.html b/sapl/templates/ajuda/tipo_afastamento.html similarity index 100% rename from templates/ajuda/tipo_afastamento.html rename to sapl/templates/ajuda/tipo_afastamento.html diff --git a/templates/ajuda/tipo_autor.html b/sapl/templates/ajuda/tipo_autor.html similarity index 100% rename from templates/ajuda/tipo_autor.html rename to sapl/templates/ajuda/tipo_autor.html diff --git a/templates/ajuda/tipo_comissao.html b/sapl/templates/ajuda/tipo_comissao.html similarity index 100% rename from templates/ajuda/tipo_comissao.html rename to sapl/templates/ajuda/tipo_comissao.html diff --git a/templates/ajuda/tipo_dependente.html b/sapl/templates/ajuda/tipo_dependente.html similarity index 100% rename from templates/ajuda/tipo_dependente.html rename to sapl/templates/ajuda/tipo_dependente.html diff --git a/templates/ajuda/tipo_documento.html b/sapl/templates/ajuda/tipo_documento.html similarity index 100% rename from templates/ajuda/tipo_documento.html rename to sapl/templates/ajuda/tipo_documento.html diff --git a/templates/ajuda/tipo_materia_legislativa.html b/sapl/templates/ajuda/tipo_materia_legislativa.html similarity index 100% rename from templates/ajuda/tipo_materia_legislativa.html rename to sapl/templates/ajuda/tipo_materia_legislativa.html diff --git a/templates/ajuda/tipo_norma_juridica.html b/sapl/templates/ajuda/tipo_norma_juridica.html similarity index 100% rename from templates/ajuda/tipo_norma_juridica.html rename to sapl/templates/ajuda/tipo_norma_juridica.html diff --git a/templates/ajuda/tipo_proposicao.html b/sapl/templates/ajuda/tipo_proposicao.html similarity index 100% rename from templates/ajuda/tipo_proposicao.html rename to sapl/templates/ajuda/tipo_proposicao.html diff --git a/templates/ajuda/tipo_sessao_plenaria.html b/sapl/templates/ajuda/tipo_sessao_plenaria.html similarity index 100% rename from templates/ajuda/tipo_sessao_plenaria.html rename to sapl/templates/ajuda/tipo_sessao_plenaria.html diff --git a/templates/ajuda/tipo_situa_militar.html b/sapl/templates/ajuda/tipo_situa_militar.html similarity index 100% rename from templates/ajuda/tipo_situa_militar.html rename to sapl/templates/ajuda/tipo_situa_militar.html diff --git a/templates/ajuda/tramitacao_lote.html b/sapl/templates/ajuda/tramitacao_lote.html similarity index 100% rename from templates/ajuda/tramitacao_lote.html rename to sapl/templates/ajuda/tramitacao_lote.html diff --git a/templates/ajuda/tramitacao_relatoria.html b/sapl/templates/ajuda/tramitacao_relatoria.html similarity index 100% rename from templates/ajuda/tramitacao_relatoria.html rename to sapl/templates/ajuda/tramitacao_relatoria.html diff --git a/templates/ajuda/troca_senha.html b/sapl/templates/ajuda/troca_senha.html similarity index 100% rename from templates/ajuda/troca_senha.html rename to sapl/templates/ajuda/troca_senha.html diff --git a/templates/ajuda/unidade_tramitacao.html b/sapl/templates/ajuda/unidade_tramitacao.html similarity index 100% rename from templates/ajuda/unidade_tramitacao.html rename to sapl/templates/ajuda/unidade_tramitacao.html diff --git a/templates/base.html b/sapl/templates/base.html similarity index 91% rename from templates/base.html rename to sapl/templates/base.html index 4fe933103..25020e9d1 100644 --- a/templates/base.html +++ b/sapl/templates/base.html @@ -46,31 +46,31 @@ @@ -105,7 +105,7 @@