@ -8,20 +8,20 @@ from django.views.generic.base import RedirectView
from django . views . generic . detail import DetailView
from django . views . generic . detail import DetailView
from django . views . generic . edit import FormMixin
from django . views . generic . edit import FormMixin
from sapl . base . models import AppConfig as AppsAppConfig
from sapl . base . models import AppConfig as AppsAppConfig
from sapl . crud . base import ( RP_DETAIL , RP_LIST , Crud ,
from sapl . comissoes . apps import AppConfig
CrudAux , MasterDetailCrud ,
from sapl . comissoes . forms import ( ComissaoForm , ComposicaoForm ,
PermissionRequiredForAppCrudMixin )
DocumentoAcessorioCreateForm ,
from sapl . comissoes . forms import ( ComissaoForm , ComposicaoForm , DocumentoAcessorioCreateForm ,
DocumentoAcessorioEditForm ,
DocumentoAcessorioEditForm , ParticipacaoCreateForm ,
ParticipacaoCreateForm , ParticipacaoEditForm ,
ParticipacaoEditForm , ReuniaoForm , PeriodoForm )
PeriodoForm , ReuniaoForm )
from sapl . crud . base import ( RP_DETAIL , RP_LIST , Crud , CrudAux ,
MasterDetailCrud ,
PermissionRequiredForAppCrudMixin )
from sapl . materia . models import MateriaLegislativa , Tramitacao
from sapl . materia . models import MateriaLegislativa , Tramitacao
from . models import ( CargoComissao , Comissao , Composicao , DocumentoAcessorio ,
from . models import ( CargoComissao , Comissao , Composicao , DocumentoAcessorio ,
Participacao , Periodo , TipoComissao , Reuniao )
Participacao , Periodo , Reuniao , TipoComissao )
from sapl . comissoes . apps import AppConfig
def pegar_url_composicao ( pk ) :
def pegar_url_composicao ( pk ) :
@ -30,6 +30,7 @@ def pegar_url_composicao(pk):
url = reverse ( ' sapl.comissoes:composicao_detail ' , kwargs = { ' pk ' : comp_pk } )
url = reverse ( ' sapl.comissoes:composicao_detail ' , kwargs = { ' pk ' : comp_pk } )
return url
return url
def pegar_url_reuniao ( pk ) :
def pegar_url_reuniao ( pk ) :
documentoacessorio = DocumentoAcessorio . objects . get ( id = pk )
documentoacessorio = DocumentoAcessorio . objects . get ( id = pk )
r_pk = documentoacessorio . reuniao . pk
r_pk = documentoacessorio . reuniao . pk
@ -42,6 +43,7 @@ TipoComissaoCrud = CrudAux.build(
TipoComissao , ' tipo_comissao ' , list_field_names = [
TipoComissao , ' tipo_comissao ' , list_field_names = [
' sigla ' , ' nome ' , ' natureza ' , ' dispositivo_regimental ' ] )
' sigla ' , ' nome ' , ' natureza ' , ' dispositivo_regimental ' ] )
class PeriodoComposicaoCrud ( CrudAux ) :
class PeriodoComposicaoCrud ( CrudAux ) :
model = Periodo
model = Periodo
@ -77,6 +79,7 @@ class ParticipacaoCrud(MasterDetailCrud):
form_class = ParticipacaoEditForm
form_class = ParticipacaoEditForm
class DeleteView ( MasterDetailCrud . DeleteView ) :
class DeleteView ( MasterDetailCrud . DeleteView ) :
def get_success_url ( self ) :
def get_success_url ( self ) :
composicao_comissao_pk = self . object . composicao . comissao . pk
composicao_comissao_pk = self . object . composicao . comissao . pk
composicao_pk = self . object . composicao . pk
composicao_pk = self . object . composicao . pk
@ -93,12 +96,11 @@ class ComposicaoCrud(MasterDetailCrud):
class CreateView ( MasterDetailCrud . CreateView ) :
class CreateView ( MasterDetailCrud . CreateView ) :
form_class = ComposicaoForm
form_class = ComposicaoForm
def get_initial ( self ) :
def get_initial ( self ) :
comissao = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
comissao = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
return { ' comissao ' : comissao }
return { ' comissao ' : comissao }
class ListView ( MasterDetailCrud . ListView ) :
class ListView ( MasterDetailCrud . ListView ) :
template_name = " comissoes/composicao_list.html "
template_name = " comissoes/composicao_list.html "
paginate_by = None
paginate_by = None
@ -180,6 +182,7 @@ class MateriasTramitacaoListView(ListView):
context [ ' object ' ] = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
context [ ' object ' ] = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
return context
return context
class ReuniaoCrud ( MasterDetailCrud ) :
class ReuniaoCrud ( MasterDetailCrud ) :
model = Reuniao
model = Reuniao
parent_field = ' comissao '
parent_field = ' comissao '
@ -187,7 +190,7 @@ class ReuniaoCrud(MasterDetailCrud):
public = [ RP_LIST , RP_DETAIL , ]
public = [ RP_LIST , RP_DETAIL , ]
class BaseMixin ( MasterDetailCrud . BaseMixin ) :
class BaseMixin ( MasterDetailCrud . BaseMixin ) :
list_field_names = [ ' nome ' , ' tema ' , ' dat a ' ]
list_field_names = [ ' data ' , ' nome ' , ' tema ' ]
class ListView ( MasterDetailCrud . ListView ) :
class ListView ( MasterDetailCrud . ListView ) :
paginate_by = 10
paginate_by = 10
@ -228,9 +231,9 @@ class ReuniaoCrud(MasterDetailCrud):
form_class = ReuniaoForm
form_class = ReuniaoForm
def get_initial ( self ) :
def get_initial ( self ) :
comissao = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
comissao = Comissao . objects . get ( id = self . kwargs [ ' pk ' ] )
return { ' comissao ' : comissao }
return { ' comissao ' : comissao }
class DocumentoAcessorioCrud ( MasterDetailCrud ) :
class DocumentoAcessorioCrud ( MasterDetailCrud ) :
@ -256,6 +259,7 @@ class DocumentoAcessorioCrud(MasterDetailCrud):
form_class = DocumentoAcessorioEditForm
form_class = DocumentoAcessorioEditForm
class DeleteView ( MasterDetailCrud . DeleteView ) :
class DeleteView ( MasterDetailCrud . DeleteView ) :
def delete ( self , * args , * * kwargs ) :
def delete ( self , * args , * * kwargs ) :
obj = self . get_object ( )
obj = self . get_object ( )
obj . delete ( )
obj . delete ( )