From 1b5a9fa193aa8009d475ae10a345316f69fc152f Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Tue, 8 Mar 2016 11:37:45 -0300 Subject: [PATCH] Move crud para crud.base --- comissoes/views.py | 2 +- compilacao/views.py | 2 +- {crud_tests => crud}/__init__.py | 0 crud.py => crud/base.py | 0 crud/tests/__init__.py | 0 {crud_tests => crud/tests}/layouts.yaml | 0 {crud_tests => crud/tests}/models.py | 0 {crud_tests => crud/tests}/settings.py | 12 ++++++------ {crud_tests => crud/tests}/templates/base.html | 0 crud_tests/test_flux.py => crud/tests/test_base.py | 4 ++-- {crud_tests => crud/tests}/urls.py | 0 {crud_tests => crud/tests}/views.py | 2 +- lexml/views.py | 2 +- materia/views.py | 2 +- norma/views.py | 2 +- painel/views.py | 2 +- parlamentares/views.py | 2 +- protocoloadm/views.py | 2 +- pytest.ini | 2 +- sessao/views.py | 2 +- test_and_check_qa.sh | 2 +- 21 files changed, 20 insertions(+), 20 deletions(-) rename {crud_tests => crud}/__init__.py (100%) rename crud.py => crud/base.py (100%) create mode 100644 crud/tests/__init__.py rename {crud_tests => crud/tests}/layouts.yaml (100%) rename {crud_tests => crud/tests}/models.py (100%) rename {crud_tests => crud/tests}/settings.py (88%) rename {crud_tests => crud/tests}/templates/base.html (100%) rename crud_tests/test_flux.py => crud/tests/test_base.py (98%) rename {crud_tests => crud/tests}/urls.py (100%) rename {crud_tests => crud/tests}/views.py (81%) diff --git a/comissoes/views.py b/comissoes/views.py index 0da73e5f7..f82e146e6 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -5,7 +5,7 @@ from django.views.generic import CreateView, ListView from django.views.generic.edit import FormMixin from vanilla import GenericView -from crud import Crud +from crud.base import Crud from materia.models import Tramitacao from parlamentares.models import Filiacao diff --git a/compilacao/views.py b/compilacao/views.py index c705a36e0..faf4309c4 100644 --- a/compilacao/views.py +++ b/compilacao/views.py @@ -27,7 +27,7 @@ from compilacao.models import (Dispositivo, Nota, TextoArticulado, TipoDispositivo, TipoNota, TipoPublicacao, TipoTextoArticulado, TipoVide, VeiculoPublicacao, Vide) -from crud import Crud, CrudListMixin, make_pagination +from crud.base import Crud, CrudListMixin, make_pagination DISPOSITIVO_SELECT_RELATED = ( 'tipo_dispositivo', diff --git a/crud_tests/__init__.py b/crud/__init__.py similarity index 100% rename from crud_tests/__init__.py rename to crud/__init__.py diff --git a/crud.py b/crud/base.py similarity index 100% rename from crud.py rename to crud/base.py diff --git a/crud/tests/__init__.py b/crud/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/crud_tests/layouts.yaml b/crud/tests/layouts.yaml similarity index 100% rename from crud_tests/layouts.yaml rename to crud/tests/layouts.yaml diff --git a/crud_tests/models.py b/crud/tests/models.py similarity index 100% rename from crud_tests/models.py rename to crud/tests/models.py diff --git a/crud_tests/settings.py b/crud/tests/settings.py similarity index 88% rename from crud_tests/settings.py rename to crud/tests/settings.py index 5393f0bb3..78e2a247f 100644 --- a/crud_tests/settings.py +++ b/crud/tests/settings.py @@ -1,6 +1,6 @@ -import os +from os.path import dirname, join -BASE_DIR = os.path.dirname(os.path.dirname(__file__)) +BASE_DIR = dirname(dirname(dirname(__file__))) DATABASES = { 'default': { @@ -15,11 +15,11 @@ INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.messages', 'django.contrib.sessions', - 'crud_tests', + 'crud.tests', 'crispy_forms', ) -ROOT_URLCONF = 'crud_tests.urls' +ROOT_URLCONF = 'crud.tests.urls' USE_TZ = True @@ -27,8 +27,8 @@ SECRET_KEY = 'zzz...' TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'crud_tests/templates'), - os.path.join(BASE_DIR, 'templates')], + 'DIRS': [join(BASE_DIR, 'crud/tests/templates'), + join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/crud_tests/templates/base.html b/crud/tests/templates/base.html similarity index 100% rename from crud_tests/templates/base.html rename to crud/tests/templates/base.html diff --git a/crud_tests/test_flux.py b/crud/tests/test_base.py similarity index 98% rename from crud_tests/test_flux.py rename to crud/tests/test_base.py index f60b2e6a0..b7dec34ca 100644 --- a/crud_tests/test_flux.py +++ b/crud/tests/test_base.py @@ -2,8 +2,8 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from crud import (CrispyLayoutFormMixin, CrudListMixin, from_to, - get_field_display, make_pagination) +from crud.base import (CrispyLayoutFormMixin, CrudListMixin, from_to, + get_field_display, make_pagination) from .models import Continent, Country from .views import CountryCrudListMixin diff --git a/crud_tests/urls.py b/crud/tests/urls.py similarity index 100% rename from crud_tests/urls.py rename to crud/tests/urls.py diff --git a/crud_tests/views.py b/crud/tests/views.py similarity index 81% rename from crud_tests/views.py rename to crud/tests/views.py index 7c699dc45..f021b6541 100644 --- a/crud_tests/views.py +++ b/crud/tests/views.py @@ -1,4 +1,4 @@ -from crud import Crud, CrudListMixin +from crud.base import Crud, CrudListMixin from .models import Country diff --git a/lexml/views.py b/lexml/views.py index d6957d1ef..dc1fb392f 100644 --- a/lexml/views.py +++ b/lexml/views.py @@ -1,4 +1,4 @@ -from crud import Crud +from crud.base import Crud from .models import LexmlProvedor, LexmlPublicador diff --git a/materia/views.py b/materia/views.py index ba1526f3f..9218ebdc0 100644 --- a/materia/views.py +++ b/materia/views.py @@ -17,7 +17,7 @@ from django.views.generic import CreateView, FormView, ListView, TemplateView from base.models import CasaLegislativa from comissoes.models import Comissao, Composicao from compilacao.views import IntegracaoTaView -from crud import Crud, make_pagination +from crud.base import Crud, make_pagination from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica from parlamentares.models import Partido from sapl.utils import get_base_url diff --git a/norma/views.py b/norma/views.py index 4213cf207..1ee90a5f7 100644 --- a/norma/views.py +++ b/norma/views.py @@ -9,7 +9,7 @@ from django.views.generic import CreateView, ListView from vanilla.views import GenericView from compilacao.views import IntegracaoTaView -from crud import Crud, make_pagination +from crud.base import Crud, make_pagination from materia.models import MateriaLegislativa from .forms import NormaJuridicaForm, NormaJuridicaPesquisaForm diff --git a/painel/views.py b/painel/views.py index b47945658..d42d0bd58 100644 --- a/painel/views.py +++ b/painel/views.py @@ -5,7 +5,7 @@ from django.http import HttpResponse, JsonResponse from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ -from crud import Crud +from crud.base import Crud from painel.models import Painel from parlamentares.models import Filiacao from sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, diff --git a/parlamentares/views.py b/parlamentares/views.py index f90292d78..a52eca12e 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormMixin from vanilla import GenericView -from crud import Crud +from crud.base import Crud from .forms import (DependenteEditForm, DependenteForm, FiliacaoEditForm, FiliacaoForm, MandatoEditForm, MandatoForm, diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 0546c79ee..019ad45ba 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -13,7 +13,7 @@ from django.views.generic.base import TemplateView from django.views.generic.edit import FormMixin from vanilla import GenericView -from crud import Crud, make_pagination +from crud.base import Crud, make_pagination from materia.models import Proposicao, TipoMateriaLegislativa from sapl.utils import create_barcode, get_client_ip diff --git a/pytest.ini b/pytest.ini index a3b1eef1f..12ce443ad 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE=sapl.settings -norecursedirs = legacy crud_tests +norecursedirs = legacy crud # REUSING DATABASE BY DEFAULT (as a performance optimization) # http://pytest-django.readthedocs.org/en/latest/database.html#example-work-flow-with-reuse-db-and-create-db diff --git a/sessao/views.py b/sessao/views.py index 93588e01d..5665adc75 100644 --- a/sessao/views.py +++ b/sessao/views.py @@ -11,7 +11,7 @@ from django.views.generic import CreateView, ListView from django.views.generic.edit import FormMixin from rest_framework import generics -from crud import Crud, make_pagination +from crud.base import Crud, make_pagination from materia.models import (Autoria, DocumentoAcessorio, TipoMateriaLegislativa, Tramitacao) from norma.models import NormaJuridica diff --git a/test_and_check_qa.sh b/test_and_check_qa.sh index c1753337c..4e9ff8dd4 100755 --- a/test_and_check_qa.sh +++ b/test_and_check_qa.sh @@ -3,5 +3,5 @@ # QA checks: run this before every commit py.test -py.test --ds=crud_tests.settings crud_tests +py.test --ds=crud.tests.settings crud/tests ./check_qa.sh