|
@ -2,12 +2,12 @@ from datetime import datetime |
|
|
from random import choice |
|
|
from random import choice |
|
|
from string import ascii_letters, digits |
|
|
from string import ascii_letters, digits |
|
|
|
|
|
|
|
|
from braces.views import PermissionRequiredMixin |
|
|
|
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import HTML, Button |
|
|
from crispy_forms.layout import HTML, Button |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
from django.contrib import messages |
|
|
from django.contrib import messages |
|
|
from django.contrib.auth import get_user_model |
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
|
from django.contrib.auth.mixins import PermissionRequiredMixin |
|
|
from django.contrib.auth.tokens import default_token_generator |
|
|
from django.contrib.auth.tokens import default_token_generator |
|
|
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist |
|
|
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist |
|
|
from django.core.mail import send_mail |
|
|
from django.core.mail import send_mail |
|
@ -26,24 +26,20 @@ from django_filters.views import FilterView |
|
|
from sapl.base.models import CasaLegislativa |
|
|
from sapl.base.models import CasaLegislativa |
|
|
from sapl.compilacao.views import IntegracaoTaView |
|
|
from sapl.compilacao.views import IntegracaoTaView |
|
|
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row |
|
|
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row |
|
|
from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, |
|
|
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, CrudDetailView, |
|
|
CrudDeleteView, CrudDetailView, CrudListView, |
|
|
MasterDetailCrud, make_pagination) |
|
|
CrudUpdateView, MasterDetailCrud, make_pagination) |
|
|
from sapl.materia.forms import AnexadaForm |
|
|
from sapl.norma.models import LegislacaoCitada |
|
|
from sapl.norma.models import LegislacaoCitada |
|
|
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, |
|
|
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, |
|
|
autor_modal, gerar_hash_arquivo, get_base_url, |
|
|
autor_modal, gerar_hash_arquivo, get_base_url, |
|
|
permissao_tb_aux, permissoes_autor, permissoes_materia, |
|
|
permissoes_autor, permissoes_materia, |
|
|
permissoes_protocoloadm) |
|
|
permissoes_protocoloadm) |
|
|
|
|
|
|
|
|
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, |
|
|
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, |
|
|
AnexadaForm, AutorForm, AutoriaForm, |
|
|
AutorForm, ConfirmarProposicaoForm, DocumentoAcessorioForm, |
|
|
ConfirmarProposicaoForm, DespachoInicialForm, |
|
|
MateriaLegislativaFilterSet, |
|
|
DocumentoAcessorioForm, LegislacaoCitadaForm, |
|
|
|
|
|
MateriaLegislativaFilterSet, NumeracaoForm, |
|
|
|
|
|
PrimeiraTramitacaoEmLoteFilterSet, ProposicaoForm, |
|
|
PrimeiraTramitacaoEmLoteFilterSet, ProposicaoForm, |
|
|
ReceberProposicaoForm, RelatoriaForm, |
|
|
ReceberProposicaoForm, TramitacaoEmLoteFilterSet, |
|
|
TramitacaoEmLoteFilterSet, TramitacaoForm, |
|
|
|
|
|
TramitacaoUpdateForm, UnidadeTramitacaoForm, |
|
|
|
|
|
filtra_tramitacao_destino, |
|
|
filtra_tramitacao_destino, |
|
|
filtra_tramitacao_destino_and_status, |
|
|
filtra_tramitacao_destino_and_status, |
|
|
filtra_tramitacao_status) |
|
|
filtra_tramitacao_status) |
|
@ -54,8 +50,26 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, |
|
|
TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, |
|
|
TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, |
|
|
Tramitacao, UnidadeTramitacao) |
|
|
Tramitacao, UnidadeTramitacao) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AnexadaCrud = Crud.build(Anexada, '') |
|
|
AnexadaCrud = Crud.build(Anexada, '') |
|
|
|
|
|
|
|
|
|
|
|
OrigemCrud = Crud.build(Origem, '') |
|
|
|
|
|
|
|
|
|
|
|
TipoMateriaCrud = CrudAux.build( |
|
|
|
|
|
TipoMateriaLegislativa, 'tipo_materia_legislativa') |
|
|
|
|
|
|
|
|
|
|
|
RegimeTramitacaoCrud = CrudAux.build( |
|
|
|
|
|
RegimeTramitacao, 'regime_tramitacao') |
|
|
|
|
|
|
|
|
|
|
|
TipoDocumentoCrud = CrudAux.build( |
|
|
|
|
|
TipoDocumento, 'tipo_documento') |
|
|
|
|
|
|
|
|
|
|
|
TipoFimRelatoriaCrud = CrudAux.build( |
|
|
|
|
|
TipoFimRelatoria, 'fim_relatoria') |
|
|
|
|
|
|
|
|
|
|
|
TipoAutorCrud = CrudAux.build( |
|
|
|
|
|
TipoAutor, 'regime_tramitacao') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def recuperar_materia(request): |
|
|
def recuperar_materia(request): |
|
|
tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) |
|
|
tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) |
|
@ -69,61 +83,6 @@ def recuperar_materia(request): |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrigemCrud(Crud): |
|
|
|
|
|
model = Origem |
|
|
|
|
|
help_path = 'origem' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TipoMateriaCrud(Crud): |
|
|
|
|
|
model = TipoMateriaLegislativa |
|
|
|
|
|
help_path = 'tipo_materia_legislativa' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RegimeTramitacaoCrud(Crud): |
|
|
|
|
|
model = RegimeTramitacao |
|
|
|
|
|
help_path = 'regime_tramitacao' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TipoDocumentoCrud(Crud): |
|
|
|
|
|
model = TipoDocumento |
|
|
|
|
|
help_path = 'tipo_documento' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TipoFimRelatoriaCrud(Crud): |
|
|
|
|
|
model = TipoFimRelatoria |
|
|
|
|
|
help_path = 'fim_relatoria' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TipoAutorCrud(Crud): |
|
|
|
|
|
model = TipoAutor |
|
|
|
|
|
help_path = 'tipo_autor' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def montar_helper_autor(self): |
|
|
def montar_helper_autor(self): |
|
|
autor_row = montar_row_autor('nome') |
|
|
autor_row = montar_row_autor('nome') |
|
|
self.helper = FormHelper() |
|
|
self.helper = FormHelper() |
|
@ -146,18 +105,14 @@ def montar_helper_autor(self): |
|
|
' class="btn btn-inverse">Cancelar</a>')])) |
|
|
' class="btn btn-inverse">Cancelar</a>')])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AutorCrud(Crud): |
|
|
class AutorCrud(CrudAux): |
|
|
model = Autor |
|
|
model = Autor |
|
|
help_path = 'autor' |
|
|
help_path = 'autor' |
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
class BaseMixin(CrudAux.BaseMixin): |
|
|
list_field_names = ['tipo', 'nome'] |
|
|
list_field_names = ['tipo', 'nome'] |
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
class UpdateView(CrudAux.UpdateView): |
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(CrudUpdateView): |
|
|
|
|
|
form_class = AutorForm |
|
|
|
|
|
layout_key = 'AutorCreate' |
|
|
layout_key = 'AutorCreate' |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
@ -169,7 +124,7 @@ class AutorCrud(Crud): |
|
|
context['helper'] = self.helper |
|
|
context['helper'] = self.helper |
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|
class CreateView(CrudCreateView): |
|
|
class CreateView(CrudAux.CreateView): |
|
|
form_class = AutorForm |
|
|
form_class = AutorForm |
|
|
layout_key = 'AutorCreate' |
|
|
layout_key = 'AutorCreate' |
|
|
|
|
|
|
|
@ -223,34 +178,10 @@ class ConfirmarEmailView(TemplateView): |
|
|
return self.render_to_response(context) |
|
|
return self.render_to_response(context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrgaoCrud(Crud): |
|
|
OrgaoCrud = CrudAux.build(Orgao, 'orgao') |
|
|
model = Orgao |
|
|
TipoProposicaoCrud = CrudAux.build(TipoProposicao, 'tipo_proposicao') |
|
|
help_path = 'orgao' |
|
|
StatusTramitacaoCrud = CrudAux.build(StatusTramitacao, 'status_tramitacao') |
|
|
|
|
|
UnidadeTramitacaoCrud = CrudAux.build(UnidadeTramitacao, 'unidade_tramitacao') |
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TipoProposicaoCrud(Crud): |
|
|
|
|
|
model = TipoProposicao |
|
|
|
|
|
help_path = 'tipo_proposicao' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StatusTramitacaoCrud(Crud): |
|
|
|
|
|
model = StatusTramitacao |
|
|
|
|
|
help_path = 'status_tramitacao' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
|
|
|
return permissao_tb_aux(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def criar_materia_proposicao(proposicao): |
|
|
def criar_materia_proposicao(proposicao): |
|
@ -290,22 +221,6 @@ def criar_doc_proposicao(proposicao): |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnidadeTramitacaoCrud(Crud): |
|
|
|
|
|
model = UnidadeTramitacao |
|
|
|
|
|
help_path = 'unidade_tramitacao' |
|
|
|
|
|
|
|
|
|
|
|
class CreateView(CrudCreateView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
form_class = UnidadeTramitacaoForm |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(CrudUpdateView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
form_class = UnidadeTramitacaoForm |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(CrudDeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProposicaoDevolvida(PermissionRequiredMixin, ListView): |
|
|
class ProposicaoDevolvida(PermissionRequiredMixin, ListView): |
|
|
template_name = 'materia/prop_devolvidas_list.html' |
|
|
template_name = 'materia/prop_devolvidas_list.html' |
|
|
model = Proposicao |
|
|
model = Proposicao |
|
@ -451,13 +366,12 @@ class ProposicaoCrud(Crud): |
|
|
model = Proposicao |
|
|
model = Proposicao |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
class BaseMixin(Crud.BaseMixin): |
|
|
list_field_names = ['data_envio', 'descricao', |
|
|
list_field_names = ['data_envio', 'descricao', |
|
|
'tipo', 'data_recebimento'] |
|
|
'tipo', 'data_recebimento'] |
|
|
|
|
|
|
|
|
class CreateView(CrudCreateView): |
|
|
class CreateView(Crud.CreateView): |
|
|
form_class = ProposicaoForm |
|
|
form_class = ProposicaoForm |
|
|
permission_required = {'materia.add_proposicao'} |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def layout_key(self): |
|
|
def layout_key(self): |
|
@ -483,9 +397,8 @@ class ProposicaoCrud(Crud): |
|
|
else: |
|
|
else: |
|
|
return {'autor': autor_id} |
|
|
return {'autor': autor_id} |
|
|
|
|
|
|
|
|
class UpdateView(CrudUpdateView): |
|
|
class UpdateView(Crud.UpdateView): |
|
|
form_class = ProposicaoForm |
|
|
form_class = ProposicaoForm |
|
|
permission_required = permissoes_autor() |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
def get_initial(self): |
|
|
initial = self.initial.copy() |
|
|
initial = self.initial.copy() |
|
@ -519,8 +432,7 @@ class ProposicaoCrud(Crud): |
|
|
messages.add_message(self.request, messages.ERROR, msg) |
|
|
messages.add_message(self.request, messages.ERROR, msg) |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
|
class DetailView(CrudDetailView): |
|
|
class DetailView(Crud.DetailView): |
|
|
permission_required = permissoes_autor() |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
def has_permission(self): |
|
|
perms = self.get_permission_required() |
|
|
perms = self.get_permission_required() |
|
@ -536,9 +448,8 @@ class ProposicaoCrud(Crud): |
|
|
context['subnav_template_name'] = '' |
|
|
context['subnav_template_name'] = '' |
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|
class ListView(CrudListView): |
|
|
class ListView(Crud.ListView): |
|
|
ordering = ['-data_envio', 'descricao'] |
|
|
ordering = ['-data_envio', 'descricao'] |
|
|
permission_required = permissoes_autor() |
|
|
|
|
|
|
|
|
|
|
|
def get_rows(self, object_list): |
|
|
def get_rows(self, object_list): |
|
|
|
|
|
|
|
@ -566,8 +477,7 @@ class ProposicaoCrud(Crud): |
|
|
|
|
|
|
|
|
return lista |
|
|
return lista |
|
|
|
|
|
|
|
|
class DeleteView(CrudDeleteView): |
|
|
class DeleteView(Crud.DeleteView): |
|
|
permission_required = {'materia.delete_proposicao'} |
|
|
|
|
|
|
|
|
|
|
|
def has_permission(self): |
|
|
def has_permission(self): |
|
|
perms = self.get_permission_required() |
|
|
perms = self.get_permission_required() |
|
@ -630,10 +540,9 @@ class RelatoriaCrud(MasterDetailCrud): |
|
|
model = Relatoria |
|
|
model = Relatoria |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
form_class = RelatoriaForm |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
def get_initial(self): |
|
|
materia = MateriaLegislativa.objects.get(id=self.kwargs['pk']) |
|
|
materia = MateriaLegislativa.objects.get(id=self.kwargs['pk']) |
|
@ -652,27 +561,20 @@ class RelatoriaCrud(MasterDetailCrud): |
|
|
|
|
|
|
|
|
return {'comissao': localizacao} |
|
|
return {'comissao': localizacao} |
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
form_class = RelatoriaForm |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TramitacaoCrud(MasterDetailCrud): |
|
|
class TramitacaoCrud(MasterDetailCrud): |
|
|
model = Tramitacao |
|
|
model = Tramitacao |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
list_field_names = ['data_tramitacao', 'unidade_tramitacao_local', |
|
|
list_field_names = ['data_tramitacao', 'unidade_tramitacao_local', |
|
|
'unidade_tramitacao_destino', 'status'] |
|
|
'unidade_tramitacao_destino', 'status'] |
|
|
|
|
|
ordered_list = False |
|
|
ordering = '-data_tramitacao', |
|
|
ordering = '-data_tramitacao', |
|
|
|
|
|
|
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
form_class = TramitacaoForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
def get_initial(self): |
|
|
local = MateriaLegislativa.objects.get( |
|
|
local = MateriaLegislativa.objects.get( |
|
@ -688,8 +590,6 @@ class TramitacaoCrud(MasterDetailCrud): |
|
|
return super(CreateView, self).post(request, *args, **kwargs) |
|
|
return super(CreateView, self).post(request, *args, **kwargs) |
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
form_class = TramitacaoUpdateForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
def post(self, request, *args, **kwargs): |
|
|
materia = MateriaLegislativa.objects.get( |
|
|
materia = MateriaLegislativa.objects.get( |
|
@ -709,7 +609,6 @@ class TramitacaoCrud(MasterDetailCrud): |
|
|
return qs.filter(**kwargs).order_by('-data_tramitacao', '-id') |
|
|
return qs.filter(**kwargs).order_by('-data_tramitacao', '-id') |
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def delete(self, request, *args, **kwargs): |
|
|
def delete(self, request, *args, **kwargs): |
|
|
tramitacao = Tramitacao.objects.get(id=self.kwargs['pk']) |
|
|
tramitacao = Tramitacao.objects.get(id=self.kwargs['pk']) |
|
@ -762,78 +661,56 @@ class DocumentoAcessorioCrud(MasterDetailCrud): |
|
|
model = DocumentoAcessorio |
|
|
model = DocumentoAcessorio |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
list_field_names = ['nome', 'tipo', 'data', 'autor', 'arquivo'] |
|
|
list_field_names = ['nome', 'tipo', 'data', 'autor', 'arquivo'] |
|
|
|
|
|
|
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
form_class = DocumentoAcessorioForm |
|
|
form_class = DocumentoAcessorioForm |
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, **kwargs): |
|
|
montar_helper_documento_acessorio(self) |
|
|
montar_helper_documento_acessorio(self) |
|
|
super(CreateView, self).__init__(*args, **kwargs) |
|
|
super(MasterDetailCrud.CreateView, self).__init__(**kwargs) |
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
def get_context_data(self, **kwargs): |
|
|
context = super(CreateView, self).get_context_data(**kwargs) |
|
|
context = super( |
|
|
|
|
|
MasterDetailCrud.CreateView, self).get_context_data(**kwargs) |
|
|
context['helper'] = self.helper |
|
|
context['helper'] = self.helper |
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
form_class = DocumentoAcessorioForm |
|
|
form_class = DocumentoAcessorioForm |
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, **kwargs): |
|
|
montar_helper_documento_acessorio(self) |
|
|
montar_helper_documento_acessorio(self) |
|
|
super(UpdateView, self).__init__(*args, **kwargs) |
|
|
super(MasterDetailCrud.UpdateView, self).__init__(**kwargs) |
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
def get_context_data(self, **kwargs): |
|
|
context = super(UpdateView, self).get_context_data(**kwargs) |
|
|
context = super(UpdateView, self).get_context_data(**kwargs) |
|
|
context['helper'] = self.helper |
|
|
context['helper'] = self.helper |
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AutoriaCrud(MasterDetailCrud): |
|
|
class AutoriaCrud(MasterDetailCrud): |
|
|
model = Autoria |
|
|
model = Autoria |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
|
|
|
form_class = AutoriaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
|
|
|
form_class = AutoriaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DespachoInicialCrud(MasterDetailCrud): |
|
|
class DespachoInicialCrud(MasterDetailCrud): |
|
|
model = DespachoInicial |
|
|
model = DespachoInicial |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
|
|
|
form_class = DespachoInicialForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
|
|
|
form_class = DespachoInicialForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LegislacaoCitadaCrud(MasterDetailCrud): |
|
|
class LegislacaoCitadaCrud(MasterDetailCrud): |
|
|
model = LegislacaoCitada |
|
|
model = LegislacaoCitada |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
list_field_names = ['norma', 'disposicoes'] |
|
|
list_field_names = ['norma', 'disposicoes'] |
|
@ -843,13 +720,7 @@ class LegislacaoCitadaCrud(MasterDetailCrud): |
|
|
return reverse('%s:%s' % (namespace, self.url_name(suffix)), |
|
|
return reverse('%s:%s' % (namespace, self.url_name(suffix)), |
|
|
args=args) |
|
|
args=args) |
|
|
|
|
|
|
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
|
|
|
form_class = LegislacaoCitadaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
form_class = LegislacaoCitadaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
def get_initial(self): |
|
|
self.initial['tipo'] = self.object.norma.tipo.id |
|
|
self.initial['tipo'] = self.object.norma.tipo.id |
|
@ -857,9 +728,6 @@ class LegislacaoCitadaCrud(MasterDetailCrud): |
|
|
self.initial['ano'] = self.object.norma.ano |
|
|
self.initial['ano'] = self.object.norma.ano |
|
|
return self.initial |
|
|
return self.initial |
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class DetailView(MasterDetailCrud.DetailView): |
|
|
class DetailView(MasterDetailCrud.DetailView): |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
@ -871,69 +739,35 @@ class NumeracaoCrud(MasterDetailCrud): |
|
|
model = Numeracao |
|
|
model = Numeracao |
|
|
parent_field = 'materia' |
|
|
parent_field = 'materia' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
|
|
|
form_class = NumeracaoForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
|
|
|
form_class = NumeracaoForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AnexadaCrud(MasterDetailCrud): |
|
|
class AnexadaCrud(MasterDetailCrud): |
|
|
model = Anexada |
|
|
model = Anexada |
|
|
parent_field = 'materia_principal' |
|
|
parent_field = 'materia_principal' |
|
|
help_path = '' |
|
|
help_path = '' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
class BaseMixin(MasterDetailCrud.BaseMixin): |
|
|
list_field_names = ['materia_anexada', 'data_anexacao'] |
|
|
list_field_names = ['materia_anexada', 'data_anexacao'] |
|
|
|
|
|
|
|
|
class CreateView(MasterDetailCrud.CreateView): |
|
|
|
|
|
form_class = AnexadaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(MasterDetailCrud.UpdateView): |
|
|
|
|
|
form_class = AnexadaForm |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
|
|
|
self.initial['tipo'] = self.object.materia_anexada.tipo.id |
|
|
|
|
|
self.initial['numero'] = self.object.materia_anexada.numero |
|
|
|
|
|
self.initial['ano'] = self.object.materia_anexada.ano |
|
|
|
|
|
|
|
|
|
|
|
return self.initial |
|
|
|
|
|
|
|
|
|
|
|
class DetailView(MasterDetailCrud.DetailView): |
|
|
class DetailView(MasterDetailCrud.DetailView): |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def layout_key(self): |
|
|
def layout_key(self): |
|
|
return 'AnexadaDetail' |
|
|
return 'AnexadaDetail' |
|
|
|
|
|
|
|
|
class DeleteView(MasterDetailCrud.DeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MateriaLegislativaCrud(Crud): |
|
|
class MateriaLegislativaCrud(Crud): |
|
|
model = MateriaLegislativa |
|
|
model = MateriaLegislativa |
|
|
help_path = 'materia_legislativa' |
|
|
help_path = 'materia_legislativa' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
class BaseMixin(CrudBaseMixin): |
|
|
class BaseMixin(Crud.BaseMixin): |
|
|
list_field_names = ['tipo', 'numero', 'ano', 'data_apresentacao'] |
|
|
list_field_names = ['tipo', 'numero', 'ano', 'data_apresentacao'] |
|
|
|
|
|
|
|
|
class CreateView(CrudCreateView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(CrudUpdateView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
class DeleteView(CrudDeleteView): |
|
|
|
|
|
permission_required = permissoes_materia() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME - qual a finalidade dessa classe?? |
|
|
class DocumentoAcessorioView(PermissionRequiredMixin, CreateView): |
|
|
class DocumentoAcessorioView(PermissionRequiredMixin, CreateView): |
|
|
template_name = "materia/documento_acessorio.html" |
|
|
template_name = "materia/documento_acessorio.html" |
|
|
form_class = DocumentoAcessorioForm |
|
|
form_class = DocumentoAcessorioForm |
|
|