示例#1
0
文件: views.py 项目: Danpeli/sapl
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 .forms import FiliacaoForm, ParlamentarCreateForm, ParlamentarForm
from .models import (CargoMesa, Coligacao, ComposicaoMesa, Dependente,
                     Filiacao, Legislatura, Mandato, NivelInstrucao,
                     Parlamentar, Partido, SessaoLegislativa, SituacaoMilitar,
                     TipoAfastamento, TipoDependente)

CargoMesaCrud = Crud.build(CargoMesa, 'cargo_mesa')
LegislaturaCrud = Crud.build(Legislatura, 'tabelas_auxiliares#legislatura')
ColigacaoCrud = Crud.build(Coligacao, 'coligacao')
PartidoCrud = Crud.build(Partido, 'partidos')
SessaoLegislativaCrud = Crud.build(SessaoLegislativa, 'sessao_legislativa')
TipoDependenteCrud = Crud.build(TipoDependente, 'tipo_dependente')
NivelInstrucaoCrud = Crud.build(NivelInstrucao, 'nivel_instrucao')
TipoAfastamentoCrud = Crud.build(TipoAfastamento, 'tipo_afastamento')
TipoMilitarCrud = Crud.build(SituacaoMilitar, 'tipo_situa_militar')

DependenteCrud = MasterDetailCrud.build(Dependente, 'parlamentar', '')


class MandatoCrud(MasterDetailCrud):
    model = Mandato
    parent_field = 'parlamentar'
示例#2
0
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 .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm,
                    ParlamentarCreateForm, ParlamentarForm)
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
                     Dependente, Filiacao, Legislatura, Mandato,
                     NivelInstrucao, Parlamentar, Partido, SessaoLegislativa,
                     SituacaoMilitar, TipoAfastamento, TipoDependente)

CargoMesaCrud = Crud.build(CargoMesa, 'cargo_mesa')
PartidoCrud = Crud.build(Partido, 'partidos')
SessaoLegislativaCrud = Crud.build(SessaoLegislativa, 'sessao_legislativa')
TipoDependenteCrud = Crud.build(TipoDependente, 'tipo_dependente')
NivelInstrucaoCrud = Crud.build(NivelInstrucao, 'nivel_instrucao')
TipoAfastamentoCrud = Crud.build(TipoAfastamento, 'tipo_afastamento')
TipoMilitarCrud = Crud.build(SituacaoMilitar, 'tipo_situa_militar')

DependenteCrud = MasterDetailCrud.build(Dependente, 'parlamentar', '')


class MandatoCrud(MasterDetailCrud):
    model = Mandato
    parent_field = 'parlamentar'
    help_path = ''
示例#3
0
from crud.base import Crud

from .models import LexmlProvedor, LexmlPublicador

LexmlProvedorCrud = Crud.build(LexmlProvedor, 'lexml_provedor')
LexmlPublicadorCrud = Crud.build(LexmlPublicador, 'lexml_publicador')
示例#4
0
文件: views.py 项目: Danpeli/sapl
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import FormView, ListView

import crud.base
from crud.base import Crud
from materia.models import Tramitacao
from parlamentares.models import Filiacao

from .forms import ComposicaoForm, ParticipacaoCadastroForm
from .models import (CargoComissao, Comissao, Composicao, Participacao,
                     Periodo, TipoComissao)

CargoCrud = Crud.build(CargoComissao, 'cargo_comissao')
PeriodoComposicaoCrud = Crud.build(Periodo, 'periodo_composicao_comissao')
TipoComissaoCrud = Crud.build(TipoComissao, 'tipo_comissao')


class ComissaoCrud(Crud):
    model = Comissao
    help_path = 'modulo_comissoes'

    class BaseMixin(crud.base.CrudBaseMixin):
        list_field_names = ['nome', 'sigla', 'tipo', 'data_criacao']


class ComposicaoView(FormView):
    template_name = 'comissoes/composicao.html'

    def get(self, request, *args, **kwargs):
示例#5
0
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 .models import (CargoComissao, Comissao, Composicao, Participacao,
                     Periodo, TipoComissao)

CargoCrud = Crud.build(CargoComissao, 'cargo_comissao')
PeriodoComposicaoCrud = Crud.build(Periodo, 'periodo_composicao_comissao')
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})
    return url


class ParticipacaoCrud(MasterDetailCrud):
    model = Participacao
    parent_field = 'composicao'
    help_path = ''

    class DetailView(MasterDetailCrud.DetailView):
        def get(self, request, *args, **kwargs):
示例#6
0
from crud.base import Crud, make_pagination
from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.utils import create_barcode, get_client_ip

from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
                    DocumentoAdministrativoFilterSet,
                    DocumentoAdministrativoForm, ProposicaoSimpleForm,
                    ProtocoloDocumentForm, ProtocoloFilterSet,
                    ProtocoloMateriaForm, TramitacaoAdmForm)
from .models import (Autor, DocumentoAcessorioAdministrativo,
                     DocumentoAdministrativo, Protocolo,
                     StatusTramitacaoAdministrativo,
                     TipoDocumentoAdministrativo, TipoInstituicao,
                     TramitacaoAdministrativo)

TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, '')
DocumentoAdministrativoCrud = Crud.build(DocumentoAdministrativo, '')
DocumentoAcessorioAdministrativoCrud = Crud.build(
    DocumentoAcessorioAdministrativo, '')
TramitacaoAdministrativoCrud = Crud.build(TramitacaoAdministrativo, '')
ProtocoloDocumentoCrud = Crud.build(Protocolo, '')
# FIXME precisa de uma chave diferente para o layout
ProtocoloMateriaCrud = Crud.build(Protocolo, '')
TipoInstituicaoCrud = Crud.build(TipoInstituicao, '')


class StatusTramitacaoAdministrativoCrud(Crud):
    model = StatusTramitacaoAdministrativo
    help_path = ''

    class BaseMixin(crud.base.CrudBaseMixin):
示例#7
0
from django.core.exceptions import ObjectDoesNotExist
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 .models import Cronometro

CronometroPainelCrud = Crud.build(Cronometro, '')


def controlador_painel(request):

    painel_created = Painel.objects.get_or_create(data_painel=date.today())
    painel = painel_created[0]

    if request.method == 'POST':
        if 'start-painel' in request.POST:
            painel.aberto = True
            painel.save()
        elif 'stop-painel' in request.POST:
            painel.aberto = False
            painel.save()
        elif 'save-painel' in request.POST:
示例#8
0
from crud.base import Crud, make_pagination
from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.utils import create_barcode, get_client_ip

from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
                    DocumentoAdministrativoFilterSet,
                    DocumentoAdministrativoForm, ProposicaoSimpleForm,
                    ProtocoloDocumentForm, ProtocoloFilterSet,
                    ProtocoloMateriaForm, TramitacaoAdmForm)
from .models import (Autor, DocumentoAcessorioAdministrativo,
                     DocumentoAdministrativo, Protocolo,
                     StatusTramitacaoAdministrativo,
                     TipoDocumentoAdministrativo, TipoInstituicao,
                     TramitacaoAdministrativo)

TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, '')
DocumentoAdministrativoCrud = Crud.build(DocumentoAdministrativo, '')
DocumentoAcessorioAdministrativoCrud = Crud.build(
    DocumentoAcessorioAdministrativo, '')
TramitacaoAdministrativoCrud = Crud.build(TramitacaoAdministrativo, '')
ProtocoloDocumentoCrud = Crud.build(Protocolo, '')
# FIXME precisa de uma chave diferente para o layout
ProtocoloMateriaCrud = Crud.build(Protocolo, '')
TipoInstituicaoCrud = Crud.build(TipoInstituicao, '')


class StatusTramitacaoAdministrativoCrud(Crud):
    model = StatusTramitacaoAdministrativo
    help_path = ''

    class BaseMixin(crud.base.CrudBaseMixin):
示例#9
0
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 .forms import NormaJuridicaForm, NormaJuridicaPesquisaForm
from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica,
                     TipoNormaJuridica)

AssuntoNormaCrud = Crud.build(AssuntoNorma, 'assunto_norma_juridica')
TipoNormaCrud = Crud.build(TipoNormaJuridica, 'tipo_norma_juridica')
LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '')


class NormaCrud(Crud):
    model = NormaJuridica
    help_path = 'norma_juridica'

    class UpdateView(crud.base.CrudUpdateView):
        form_class = NormaJuridicaForm

        @property
        def layout_key(self):
            return 'NormaJuridicaCreate'

        def get_initial(self):
            norma = NormaJuridica.objects.get(id=self.kwargs['pk'])