Browse Source

Move crud p/ pacote separado e seus testes p/ app

pull/216/head
Marcio Mazza 9 years ago
committed by Eduardo Edson Batista Cordeiro Alves
parent
commit
54112e539f
  1. 2
      comissoes/views.py
  2. 2
      compilacao/views.py
  3. 0
      crud.py
  4. 0
      crud_tests/__init__.py
  5. 0
      crud_tests/test_flux.py
  6. 2
      crud_tests/urls.py
  7. 2
      lexml/views.py
  8. 7
      materia/views.py
  9. 2
      norma/views.py
  10. 2
      painel/views.py
  11. 2
      parlamentares/views.py
  12. 5
      protocoloadm/views.py
  13. 4
      sessao/views.py

2
comissoes/views.py

@ -5,9 +5,9 @@ from django.views.generic import ListView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla import GenericView from vanilla import GenericView
from crud import build_crud
from materia.models import Tramitacao from materia.models import Tramitacao
from parlamentares.models import Filiacao from parlamentares.models import Filiacao
from sapl.crud import build_crud
from .forms import (CadastrarComissaoForm, ComposicaoForm, from .forms import (CadastrarComissaoForm, ComposicaoForm,
ParticipacaoCadastroForm) ParticipacaoCadastroForm)

2
compilacao/views.py

@ -27,7 +27,7 @@ from compilacao.models import (Dispositivo, Nota,
TextoArticulado, TipoDispositivo, TipoNota, TextoArticulado, TipoDispositivo, TipoNota,
TipoPublicacao, TipoTextoArticulado, TipoVide, TipoPublicacao, TipoTextoArticulado, TipoVide,
VeiculoPublicacao, Vide) VeiculoPublicacao, Vide)
from sapl.crud import NO_ENTRIES_MSG, build_crud, make_pagination from crud import NO_ENTRIES_MSG, build_crud, make_pagination
DISPOSITIVO_SELECT_RELATED = ( DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo', 'tipo_dispositivo',

0
sapl/crud.py → crud.py

0
sapl/teststubs/__init__.py → crud_tests/__init__.py

0
sapl/test_crud.py → crud_tests/test_flux.py

2
sapl/teststubs/urls_for_list_test.py → crud_tests/urls.py

@ -2,7 +2,7 @@ from django.conf.urls import include, url
from comissoes.models import Comissao from comissoes.models import Comissao
from comissoes.urls import comissao_url_patterns from comissoes.urls import comissao_url_patterns
from sapl.crud import build_crud from crud import build_crud
crud = build_crud( crud = build_crud(
Comissao, '', [ Comissao, '', [

2
lexml/views.py

@ -1,6 +1,6 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.crud import build_crud from crud import build_crud
from .models import LexmlProvedor, LexmlPublicador from .models import LexmlProvedor, LexmlPublicador

7
materia/views.py

@ -12,12 +12,11 @@ from django.views.generic import ListView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla.views import GenericView from vanilla.views import GenericView
import sapl
from comissoes.models import Comissao, Composicao from comissoes.models import Comissao, Composicao
from compilacao.views import IntegracaoTaView from compilacao.views import IntegracaoTaView
from crud import build_crud, make_pagination
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica
from parlamentares.models import Partido from parlamentares.models import Partido
from sapl.crud import build_crud
from sessao.models import AcompanharMateria from sessao.models import AcompanharMateria
from .forms import (AutoriaForm, DespachoInicialForm, DocumentoAcessorioForm, from .forms import (AutoriaForm, DespachoInicialForm, DocumentoAcessorioForm,
@ -1251,7 +1250,7 @@ class ProposicaoListView(ListView):
paginator = context['paginator'] paginator = context['paginator']
page_obj = context['page_obj'] page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination( context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages) page_obj.number, paginator.num_pages)
return context return context
@ -1434,7 +1433,7 @@ class PesquisaMateriaListView(FormMixin, ListView):
paginator = context['paginator'] paginator = context['paginator']
page_obj = context['page_obj'] page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination( context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages) page_obj.number, paginator.num_pages)
return context return context

2
norma/views.py

@ -8,8 +8,8 @@ from django.views.generic.edit import FormMixin
from vanilla.views import GenericView from vanilla.views import GenericView
from compilacao.views import IntegracaoTaView from compilacao.views import IntegracaoTaView
from crud import build_crud
from materia.models import MateriaLegislativa, TipoMateriaLegislativa from materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.crud import build_crud
from .forms import NormaJuridicaForm from .forms import NormaJuridicaForm
from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica, from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica,

2
painel/views.py

@ -5,9 +5,9 @@ from django.http import HttpResponse, JsonResponse
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from crud import build_crud
from painel.models import Painel from painel.models import Painel
from parlamentares.models import Filiacao from parlamentares.models import Filiacao
from sapl.crud import build_crud
from sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, from sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia,
RegistroVotacao, SessaoPlenaria, RegistroVotacao, SessaoPlenaria,
SessaoPlenariaPresenca, VotoParlamentar) SessaoPlenariaPresenca, VotoParlamentar)

2
parlamentares/views.py

@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla import GenericView from vanilla import GenericView
from sapl.crud import build_crud from crud import build_crud
from .forms import (DependenteEditForm, DependenteForm, FiliacaoEditForm, from .forms import (DependenteEditForm, DependenteForm, FiliacaoEditForm,
FiliacaoForm, MandatoEditForm, MandatoForm, FiliacaoForm, MandatoEditForm, MandatoForm,

5
protocoloadm/views.py

@ -15,8 +15,8 @@ from django.views.generic.edit import FormMixin
from vanilla import GenericView from vanilla import GenericView
import sapl import sapl
from crud import build_crud, make_pagination
from materia.models import Proposicao, TipoMateriaLegislativa from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.crud import build_crud
from sapl.utils import create_barcode from sapl.utils import create_barcode
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
@ -118,7 +118,7 @@ class ProtocoloListView(FormMixin, ListView):
paginator = context['paginator'] paginator = context['paginator']
page_obj = context['page_obj'] page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination( context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages) page_obj.number, paginator.num_pages)
return context return context
@ -322,7 +322,6 @@ class ComprovanteProtocoloView(TemplateView):
numero = self.kwargs['pk'] numero = self.kwargs['pk']
ano = self.kwargs['ano'] ano = self.kwargs['ano']
protocolo = Protocolo.objects.get(ano=ano, numero=numero) protocolo = Protocolo.objects.get(ano=ano, numero=numero)
# numero is string, padd with zeros left via .zfill() # numero is string, padd with zeros left via .zfill()
base64_data = create_barcode(numero.zfill(6)) base64_data = create_barcode(numero.zfill(6))
barcode = 'data:image/png;base64,{0}'.format(base64_data) barcode = 'data:image/png;base64,{0}'.format(base64_data)

4
sessao/views.py

@ -11,11 +11,11 @@ from django.views.generic.edit import FormMixin
from rest_framework import generics from rest_framework import generics
import sapl import sapl
from crud import build_crud, make_pagination
from materia.models import (Autoria, DocumentoAcessorio, from materia.models import (Autoria, DocumentoAcessorio,
TipoMateriaLegislativa, Tramitacao) TipoMateriaLegislativa, Tramitacao)
from norma.models import NormaJuridica from norma.models import NormaJuridica
from parlamentares.models import Parlamentar from parlamentares.models import Parlamentar
from sapl.crud import build_crud
from sessao.serializers import SessaoPlenariaSerializer from sessao.serializers import SessaoPlenariaSerializer
from .forms import (AcompanharMateriaForm, ExpedienteForm, ListMateriaForm, from .forms import (AcompanharMateriaForm, ExpedienteForm, ListMateriaForm,
@ -2184,7 +2184,7 @@ class SessaoListView(ListView):
paginator = context['paginator'] paginator = context['paginator']
page_obj = context['page_obj'] page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination( context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages) page_obj.number, paginator.num_pages)
return context return context

Loading…
Cancel
Save