Browse Source

Merge pull request #499 from interlegis/497-encapsulamento-das-apps

Fix #497 Encaps apps secundárias dentro app sapl
pull/507/head
Edward 9 years ago
committed by GitHub
parent
commit
6690566e06
  1. 6
      MANIFEST.in
  2. 16
      README.rst
  3. 1
      base/__init__.py
  4. 1
      comissoes/__init__.py
  5. 1
      lexml/__init__.py
  6. 1
      materia/__init__.py
  7. 1
      norma/__init__.py
  8. 1
      painel/__init__.py
  9. 1
      parlamentares/__init__.py
  10. 1
      protocoloadm/__init__.py
  11. 2
      requirements/requirements.txt
  12. 1
      sapl/base/__init__.py
  13. 2
      sapl/base/admin.py
  14. 3
      sapl/base/apps.py
  15. 22
      sapl/base/forms.py
  16. 0
      sapl/base/layouts.yaml
  17. 0
      sapl/base/migrations/0001_initial.py
  18. 0
      sapl/base/migrations/0002_casalegislativa_codigo.py
  19. 5
      sapl/base/migrations/0003_auto_20160107_1122.py
  20. 0
      sapl/base/migrations/0004_auto_20160107_1158.py
  21. 0
      sapl/base/migrations/0005_auto_20160107_1244.py
  22. 0
      sapl/base/migrations/0006_auto_20160107_1257.py
  23. 8
      sapl/base/migrations/0007_auto_20160107_1837.py
  24. 24
      sapl/base/migrations/0008_auto_20160216_1015.py
  25. 0
      sapl/base/migrations/0009_auto_20160307_0905.py
  26. 0
      sapl/base/migrations/0010_auto_20160309_1323.py
  27. 0
      sapl/base/migrations/0011_problemamigracao.py
  28. 0
      sapl/base/migrations/0012_problemamigracao_eh_stub.py
  29. 0
      sapl/base/migrations/0013_remove_problemamigracao_endereco.py
  30. 0
      sapl/base/migrations/0014_auto_20160502_1635.py
  31. 0
      sapl/base/migrations/0015_problemamigracao_nome_campo.py
  32. 0
      sapl/base/migrations/__init__.py
  33. 2
      sapl/base/models.py
  34. 0
      sapl/base/templatetags/__init__.py
  35. 0
      sapl/base/templatetags/common_tags.py
  36. 48
      sapl/base/templatetags/menus.py
  37. 7
      sapl/base/tests/test_login.py
  38. 0
      sapl/base/tests/teststub_urls.py
  39. 0
      sapl/base/urls.py
  40. 9
      sapl/base/views.py
  41. 1
      sapl/comissoes/__init__.py
  42. 0
      sapl/comissoes/admin.py
  43. 3
      sapl/comissoes/apps.py
  44. 0
      sapl/comissoes/forms.py
  45. 0
      sapl/comissoes/layouts.yaml
  46. 0
      sapl/comissoes/legacy.yaml
  47. 0
      sapl/comissoes/migrations/0001_initial.py
  48. 0
      sapl/comissoes/migrations/0002_auto_20150729_1310.py
  49. 0
      sapl/comissoes/migrations/0003_auto_20160216_1015.py
  50. 0
      sapl/comissoes/migrations/0004_auto_20160307_0905.py
  51. 0
      sapl/comissoes/migrations/__init__.py
  52. 2
      sapl/comissoes/models.py
  53. 10
      sapl/comissoes/tests/test_comissoes.py
  54. 6
      sapl/comissoes/urls.py
  55. 18
      sapl/comissoes/views.py
  56. 1
      sapl/compilacao/__init__.py
  57. 0
      sapl/compilacao/admin.py
  58. 3
      sapl/compilacao/apps.py
  59. 15
      sapl/compilacao/forms.py
  60. 0
      sapl/compilacao/layouts.yaml
  61. 0
      sapl/compilacao/migrations/0001_initial.py
  62. 0
      sapl/compilacao/migrations/0002_auto_20150907_2334.py
  63. 0
      sapl/compilacao/migrations/0003_auto_20150911_1735.py
  64. 0
      sapl/compilacao/migrations/0004_auto_20150914_0842.py
  65. 0
      sapl/compilacao/migrations/0005_auto_20150924_1012.py
  66. 0
      sapl/compilacao/migrations/0006_auto_20150924_1121.py
  67. 0
      sapl/compilacao/migrations/0007_auto_20150924_1131.py
  68. 0
      sapl/compilacao/migrations/0008_auto_20151005_1023.py
  69. 0
      sapl/compilacao/migrations/0009_auto_20151007_1635.py
  70. 0
      sapl/compilacao/migrations/0010_auto_20151105_1532.py
  71. 0
      sapl/compilacao/migrations/0011_auto_20151105_1540.py
  72. 0
      sapl/compilacao/migrations/0012_auto_20151105_1658.py
  73. 0
      sapl/compilacao/migrations/0013_auto_20151106_1843.py
  74. 0
      sapl/compilacao/migrations/0014_auto_20151107_1836.py
  75. 0
      sapl/compilacao/migrations/0015_auto_20151115_2310.py
  76. 0
      sapl/compilacao/migrations/0016_auto_20151119_0950.py
  77. 0
      sapl/compilacao/migrations/0017_auto_20151119_1035.py
  78. 0
      sapl/compilacao/migrations/0018_auto_20151119_1052.py
  79. 0
      sapl/compilacao/migrations/0019_auto_20151119_1120.py
  80. 0
      sapl/compilacao/migrations/0020_auto_20151119_1126.py
  81. 0
      sapl/compilacao/migrations/0021_auto_20151119_1617.py
  82. 0
      sapl/compilacao/migrations/0022_auto_20151120_1503.py
  83. 0
      sapl/compilacao/migrations/0023_auto_20151120_1529.py
  84. 0
      sapl/compilacao/migrations/0024_auto_20151120_1814.py
  85. 0
      sapl/compilacao/migrations/0025_auto_20151122_1744.py
  86. 0
      sapl/compilacao/migrations/0026_auto_20151122_1756.py
  87. 0
      sapl/compilacao/migrations/0027_auto_20151130_1632.py
  88. 0
      sapl/compilacao/migrations/0028_auto_20151201_0042.py
  89. 0
      sapl/compilacao/migrations/0029_auto_20151201_1611.py
  90. 0
      sapl/compilacao/migrations/0030_auto_20151203_1114.py
  91. 0
      sapl/compilacao/migrations/0030_auto_20151203_1117.py
  92. 0
      sapl/compilacao/migrations/0031_merge.py
  93. 0
      sapl/compilacao/migrations/0032_auto_20151213_1538.py
  94. 0
      sapl/compilacao/migrations/0033_auto_20151226_1320.py
  95. 0
      sapl/compilacao/migrations/0034_auto_20151226_1321.py
  96. 0
      sapl/compilacao/migrations/0035_auto_20151226_1349.py
  97. 0
      sapl/compilacao/migrations/0036_auto_20151226_1411.py
  98. 0
      sapl/compilacao/migrations/0037_auto_20151226_1414.py
  99. 0
      sapl/compilacao/migrations/0038_tipotextoarticulado_model.py
  100. 0
      sapl/compilacao/migrations/0039_auto_20151226_1433.py

6
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]

16
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:

1
base/__init__.py

@ -1 +0,0 @@
default_app_config = 'base.apps.AppConfig'

1
comissoes/__init__.py

@ -1 +0,0 @@
default_app_config = 'comissoes.apps.AppConfig'

1
lexml/__init__.py

@ -1 +0,0 @@
default_app_config = 'lexml.apps.AppConfig'

1
materia/__init__.py

@ -1 +0,0 @@
default_app_config = 'materia.apps.AppConfig'

1
norma/__init__.py

@ -1 +0,0 @@
default_app_config = 'norma.apps.AppConfig'

1
painel/__init__.py

@ -1 +0,0 @@
default_app_config = 'painel.apps.AppConfig'

1
parlamentares/__init__.py

@ -1 +0,0 @@
default_app_config = 'parlamentares.apps.AppConfig'

1
protocoloadm/__init__.py

@ -1 +0,0 @@
default_app_config = 'protocoloadm.apps.AppConfig'

2
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
gunicorn==19.4.5

1
sapl/base/__init__.py

@ -0,0 +1 @@
default_app_config = 'sapl.base.apps.AppConfig'

2
base/admin.py → 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__)

3
base/apps.py → 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')

22
base/forms.py → 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'}))

0
base/layouts.yaml → sapl/base/layouts.yaml

0
base/migrations/0001_initial.py → sapl/base/migrations/0001_initial.py

0
base/migrations/0002_casalegislativa_codigo.py → sapl/base/migrations/0002_casalegislativa_codigo.py

5
base/migrations/0003_auto_20160107_1122.py → 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),
),
]

0
base/migrations/0004_auto_20160107_1158.py → sapl/base/migrations/0004_auto_20160107_1158.py

0
base/migrations/0005_auto_20160107_1244.py → sapl/base/migrations/0005_auto_20160107_1244.py

0
base/migrations/0006_auto_20160107_1257.py → sapl/base/migrations/0006_auto_20160107_1257.py

8
base/migrations/0007_auto_20160107_1837.py → 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),
),
]

24
base/migrations/0008_auto_20160216_1015.py → 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),
),
]

0
base/migrations/0009_auto_20160307_0905.py → sapl/base/migrations/0009_auto_20160307_0905.py

0
base/migrations/0010_auto_20160309_1323.py → sapl/base/migrations/0010_auto_20160309_1323.py

0
base/migrations/0011_problemamigracao.py → sapl/base/migrations/0011_problemamigracao.py

0
base/migrations/0012_problemamigracao_eh_stub.py → sapl/base/migrations/0012_problemamigracao_eh_stub.py

0
base/migrations/0013_remove_problemamigracao_endereco.py → sapl/base/migrations/0013_remove_problemamigracao_endereco.py

0
base/migrations/0014_auto_20160502_1635.py → sapl/base/migrations/0014_auto_20160502_1635.py

0
base/migrations/0015_problemamigracao_nome_campo.py → sapl/base/migrations/0015_problemamigracao_nome_campo.py

0
base/migrations/__init__.py → sapl/base/migrations/__init__.py

2
base/models.py → 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):

0
base/templatetags/__init__.py → sapl/base/templatetags/__init__.py

0
base/templatetags/common_tags.py → sapl/base/templatetags/common_tags.py

48
base/templatetags/menus.py → 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}

7
base/tests/test_login.py → 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 '<a href="/logout/">Sair</a>' 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/', '/'),

0
base/tests/teststub_urls.py → sapl/base/tests/teststub_urls.py

0
base/urls.py → sapl/base/urls.py

9
base/views.py → 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

1
sapl/comissoes/__init__.py

@ -0,0 +1 @@
default_app_config = 'sapl.comissoes.apps.AppConfig'

0
comissoes/admin.py → sapl/comissoes/admin.py

3
comissoes/apps.py → 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')

0
comissoes/forms.py → sapl/comissoes/forms.py

0
comissoes/layouts.yaml → sapl/comissoes/layouts.yaml

0
comissoes/legacy.yaml → sapl/comissoes/legacy.yaml

0
comissoes/migrations/0001_initial.py → sapl/comissoes/migrations/0001_initial.py

0
comissoes/migrations/0002_auto_20150729_1310.py → sapl/comissoes/migrations/0002_auto_20150729_1310.py

0
comissoes/migrations/0003_auto_20160216_1015.py → sapl/comissoes/migrations/0003_auto_20160216_1015.py

0
comissoes/migrations/0004_auto_20160307_0905.py → sapl/comissoes/migrations/0004_auto_20160307_0905.py

0
comissoes/migrations/__init__.py → sapl/comissoes/migrations/__init__.py

2
comissoes/models.py → 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

10
comissoes/tests/test_comissoes.py → 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)

6
comissoes/urls.py → 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

18
comissoes/views.py → 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']

1
sapl/compilacao/__init__.py

@ -0,0 +1 @@
default_app_config = 'sapl.compilacao.apps.AppConfig'

0
compilacao/admin.py → sapl/compilacao/admin.py

3
compilacao/apps.py → 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')

15
compilacao/forms.py → 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 = {

0
compilacao/layouts.yaml → sapl/compilacao/layouts.yaml

0
compilacao/migrations/0001_initial.py → sapl/compilacao/migrations/0001_initial.py

0
compilacao/migrations/0002_auto_20150907_2334.py → sapl/compilacao/migrations/0002_auto_20150907_2334.py

0
compilacao/migrations/0003_auto_20150911_1735.py → sapl/compilacao/migrations/0003_auto_20150911_1735.py

0
compilacao/migrations/0004_auto_20150914_0842.py → sapl/compilacao/migrations/0004_auto_20150914_0842.py

0
compilacao/migrations/0005_auto_20150924_1012.py → sapl/compilacao/migrations/0005_auto_20150924_1012.py

0
compilacao/migrations/0006_auto_20150924_1121.py → sapl/compilacao/migrations/0006_auto_20150924_1121.py

0
compilacao/migrations/0007_auto_20150924_1131.py → sapl/compilacao/migrations/0007_auto_20150924_1131.py

0
compilacao/migrations/0008_auto_20151005_1023.py → sapl/compilacao/migrations/0008_auto_20151005_1023.py

0
compilacao/migrations/0009_auto_20151007_1635.py → sapl/compilacao/migrations/0009_auto_20151007_1635.py

0
compilacao/migrations/0010_auto_20151105_1532.py → sapl/compilacao/migrations/0010_auto_20151105_1532.py

0
compilacao/migrations/0011_auto_20151105_1540.py → sapl/compilacao/migrations/0011_auto_20151105_1540.py

0
compilacao/migrations/0012_auto_20151105_1658.py → sapl/compilacao/migrations/0012_auto_20151105_1658.py

0
compilacao/migrations/0013_auto_20151106_1843.py → sapl/compilacao/migrations/0013_auto_20151106_1843.py

0
compilacao/migrations/0014_auto_20151107_1836.py → sapl/compilacao/migrations/0014_auto_20151107_1836.py

0
compilacao/migrations/0015_auto_20151115_2310.py → sapl/compilacao/migrations/0015_auto_20151115_2310.py

0
compilacao/migrations/0016_auto_20151119_0950.py → sapl/compilacao/migrations/0016_auto_20151119_0950.py

0
compilacao/migrations/0017_auto_20151119_1035.py → sapl/compilacao/migrations/0017_auto_20151119_1035.py

0
compilacao/migrations/0018_auto_20151119_1052.py → sapl/compilacao/migrations/0018_auto_20151119_1052.py

0
compilacao/migrations/0019_auto_20151119_1120.py → sapl/compilacao/migrations/0019_auto_20151119_1120.py

0
compilacao/migrations/0020_auto_20151119_1126.py → sapl/compilacao/migrations/0020_auto_20151119_1126.py

0
compilacao/migrations/0021_auto_20151119_1617.py → sapl/compilacao/migrations/0021_auto_20151119_1617.py

0
compilacao/migrations/0022_auto_20151120_1503.py → sapl/compilacao/migrations/0022_auto_20151120_1503.py

0
compilacao/migrations/0023_auto_20151120_1529.py → sapl/compilacao/migrations/0023_auto_20151120_1529.py

0
compilacao/migrations/0024_auto_20151120_1814.py → sapl/compilacao/migrations/0024_auto_20151120_1814.py

0
compilacao/migrations/0025_auto_20151122_1744.py → sapl/compilacao/migrations/0025_auto_20151122_1744.py

0
compilacao/migrations/0026_auto_20151122_1756.py → sapl/compilacao/migrations/0026_auto_20151122_1756.py

0
compilacao/migrations/0027_auto_20151130_1632.py → sapl/compilacao/migrations/0027_auto_20151130_1632.py

0
compilacao/migrations/0028_auto_20151201_0042.py → sapl/compilacao/migrations/0028_auto_20151201_0042.py

0
compilacao/migrations/0029_auto_20151201_1611.py → sapl/compilacao/migrations/0029_auto_20151201_1611.py

0
compilacao/migrations/0030_auto_20151203_1114.py → sapl/compilacao/migrations/0030_auto_20151203_1114.py

0
compilacao/migrations/0030_auto_20151203_1117.py → sapl/compilacao/migrations/0030_auto_20151203_1117.py

0
compilacao/migrations/0031_merge.py → sapl/compilacao/migrations/0031_merge.py

0
compilacao/migrations/0032_auto_20151213_1538.py → sapl/compilacao/migrations/0032_auto_20151213_1538.py

0
compilacao/migrations/0033_auto_20151226_1320.py → sapl/compilacao/migrations/0033_auto_20151226_1320.py

0
compilacao/migrations/0034_auto_20151226_1321.py → sapl/compilacao/migrations/0034_auto_20151226_1321.py

0
compilacao/migrations/0035_auto_20151226_1349.py → sapl/compilacao/migrations/0035_auto_20151226_1349.py

0
compilacao/migrations/0036_auto_20151226_1411.py → sapl/compilacao/migrations/0036_auto_20151226_1411.py

0
compilacao/migrations/0037_auto_20151226_1414.py → sapl/compilacao/migrations/0037_auto_20151226_1414.py

0
compilacao/migrations/0038_tipotextoarticulado_model.py → sapl/compilacao/migrations/0038_tipotextoarticulado_model.py

0
compilacao/migrations/0039_auto_20151226_1433.py → sapl/compilacao/migrations/0039_auto_20151226_1433.py

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save