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. 15
      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 vanilla import GenericView
from crud import build_crud
from materia.models import Tramitacao
from parlamentares.models import Filiacao
from sapl.crud import build_crud
from .forms import (CadastrarComissaoForm, ComposicaoForm,
ParticipacaoCadastroForm)

2
compilacao/views.py

@ -27,7 +27,7 @@ from compilacao.models import (Dispositivo, Nota,
TextoArticulado, TipoDispositivo, TipoNota,
TipoPublicacao, TipoTextoArticulado, TipoVide,
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 = (
'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.urls import comissao_url_patterns
from sapl.crud import build_crud
from crud import build_crud
crud = build_crud(
Comissao, '', [

2
lexml/views.py

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

15
materia/views.py

@ -12,12 +12,11 @@ from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from vanilla.views import GenericView
import sapl
from comissoes.models import Comissao, Composicao
from compilacao.views import IntegracaoTaView
from crud import build_crud, make_pagination
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica
from parlamentares.models import Partido
from sapl.crud import build_crud
from sessao.models import AcompanharMateria
from .forms import (AutoriaForm, DespachoInicialForm, DocumentoAcessorioForm,
@ -879,12 +878,12 @@ class RelatoriaView(FormMixin, GenericView):
})
else:
relatorias = Relatoria.objects.filter(
materia_id=kwargs['pk']).order_by(
'-data_designacao_relator')
materia_id=kwargs['pk']).order_by(
'-data_designacao_relator')
localizacao = Tramitacao.objects.filter(
materia=materia).last()
materia=materia).last()
comissao = Comissao.objects.get(
id=localizacao.unidade_tramitacao_destino.comissao.id)
id=localizacao.unidade_tramitacao_destino.comissao.id)
if form.is_valid():
relatoria = form.save(commit=False)
@ -1251,7 +1250,7 @@ class ProposicaoListView(ListView):
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination(
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
return context
@ -1434,7 +1433,7 @@ class PesquisaMateriaListView(FormMixin, ListView):
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination(
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
return context

2
norma/views.py

@ -8,8 +8,8 @@ from django.views.generic.edit import FormMixin
from vanilla.views import GenericView
from compilacao.views import IntegracaoTaView
from crud import build_crud
from materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.crud import build_crud
from .forms import NormaJuridicaForm
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.utils.translation import ugettext_lazy as _
from crud import build_crud
from painel.models import Painel
from parlamentares.models import Filiacao
from sapl.crud import build_crud
from sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia,
RegistroVotacao, SessaoPlenaria,
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 vanilla import GenericView
from sapl.crud import build_crud
from crud import build_crud
from .forms import (DependenteEditForm, DependenteForm, FiliacaoEditForm,
FiliacaoForm, MandatoEditForm, MandatoForm,

5
protocoloadm/views.py

@ -15,8 +15,8 @@ from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from crud import build_crud, make_pagination
from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.crud import build_crud
from sapl.utils import create_barcode
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
@ -118,7 +118,7 @@ class ProtocoloListView(FormMixin, ListView):
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination(
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
return context
@ -322,7 +322,6 @@ class ComprovanteProtocoloView(TemplateView):
numero = self.kwargs['pk']
ano = self.kwargs['ano']
protocolo = Protocolo.objects.get(ano=ano, numero=numero)
# numero is string, padd with zeros left via .zfill()
base64_data = create_barcode(numero.zfill(6))
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
import sapl
from crud import build_crud, make_pagination
from materia.models import (Autoria, DocumentoAcessorio,
TipoMateriaLegislativa, Tramitacao)
from norma.models import NormaJuridica
from parlamentares.models import Parlamentar
from sapl.crud import build_crud
from sessao.serializers import SessaoPlenariaSerializer
from .forms import (AcompanharMateriaForm, ExpedienteForm, ListMateriaForm,
@ -2184,7 +2184,7 @@ class SessaoListView(ListView):
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = sapl.crud.make_pagination(
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
return context

Loading…
Cancel
Save