|
@ -7,10 +7,11 @@ from django.core.urlresolvers import reverse, reverse_lazy |
|
|
from django.forms.utils import ErrorList |
|
|
from django.forms.utils import ErrorList |
|
|
from django.utils.html import strip_tags |
|
|
from django.utils.html import strip_tags |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from django.views.generic import CreateView, ListView |
|
|
from django.views.generic import ListView, TemplateView |
|
|
from django.views.generic.edit import FormMixin |
|
|
from django.views.generic.edit import FormMixin |
|
|
from rest_framework import generics |
|
|
from rest_framework import generics |
|
|
|
|
|
|
|
|
|
|
|
import crud.base |
|
|
from crud.base import Crud, make_pagination |
|
|
from crud.base import Crud, make_pagination |
|
|
from materia.models import (Autoria, DocumentoAcessorio, |
|
|
from materia.models import (Autoria, DocumentoAcessorio, |
|
|
TipoMateriaLegislativa, Tramitacao) |
|
|
TipoMateriaLegislativa, Tramitacao) |
|
@ -20,8 +21,7 @@ from sessao.serializers import SessaoPlenariaSerializer |
|
|
|
|
|
|
|
|
from .forms import (ExpedienteForm, ListMateriaForm, MateriaOrdemDiaForm, |
|
|
from .forms import (ExpedienteForm, ListMateriaForm, MateriaOrdemDiaForm, |
|
|
MesaForm, OradorDeleteForm, OradorForm, PresencaForm, |
|
|
MesaForm, OradorDeleteForm, OradorForm, PresencaForm, |
|
|
SessaoForm, VotacaoEditForm, VotacaoForm, |
|
|
VotacaoEditForm, VotacaoForm, VotacaoNominalForm) |
|
|
VotacaoNominalForm) |
|
|
|
|
|
from .models import (CargoMesa, ExpedienteMateria, ExpedienteSessao, |
|
|
from .models import (CargoMesa, ExpedienteMateria, ExpedienteSessao, |
|
|
IntegranteMesa, MateriaLegislativa, Orador, |
|
|
IntegranteMesa, MateriaLegislativa, Orador, |
|
|
OradorExpediente, OrdemDia, PresencaOrdemDia, |
|
|
OradorExpediente, OrdemDia, PresencaOrdemDia, |
|
@ -30,7 +30,6 @@ from .models import (CargoMesa, ExpedienteMateria, ExpedienteSessao, |
|
|
VotoParlamentar) |
|
|
VotoParlamentar) |
|
|
|
|
|
|
|
|
TipoSessaoCrud = Crud.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') |
|
|
TipoSessaoCrud = Crud.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') |
|
|
SessaoCrud = Crud.build(SessaoPlenaria, '') |
|
|
|
|
|
ExpedienteMateriaCrud = Crud.build(ExpedienteMateria, '') |
|
|
ExpedienteMateriaCrud = Crud.build(ExpedienteMateria, '') |
|
|
OrdemDiaCrud = Crud.build(OrdemDia, '') |
|
|
OrdemDiaCrud = Crud.build(OrdemDia, '') |
|
|
TipoResultadoVotacaoCrud = Crud.build( |
|
|
TipoResultadoVotacaoCrud = Crud.build( |
|
@ -39,6 +38,24 @@ TipoExpedienteCrud = Crud.build(TipoExpediente, 'tipo_expediente') |
|
|
RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') |
|
|
RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SessaoCrud(Crud): |
|
|
|
|
|
model = SessaoPlenaria |
|
|
|
|
|
help_path = 'sessao_plenaria' |
|
|
|
|
|
|
|
|
|
|
|
class BaseMixin(crud.base.BaseMixin): |
|
|
|
|
|
list_field_names = ['numero', 'tipo', 'legislatura', |
|
|
|
|
|
'sessao_legislativa', 'data_inicio', 'hora_inicio'] |
|
|
|
|
|
|
|
|
|
|
|
class CrudDetailView(crud.base.BaseMixin, crud.base.DetailView): |
|
|
|
|
|
model = SessaoPlenaria |
|
|
|
|
|
help_path = 'sessao_plenaria' |
|
|
|
|
|
|
|
|
|
|
|
class CreateView(crud.base.CrudCreateView): |
|
|
|
|
|
|
|
|
|
|
|
def get_success_url(self): |
|
|
|
|
|
return reverse_lazy('sessao:sessaoplenaria_list') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PresencaMixin: |
|
|
class PresencaMixin: |
|
|
|
|
|
|
|
|
def get_parlamentares(self): |
|
|
def get_parlamentares(self): |
|
@ -56,9 +73,10 @@ class PresencaMixin: |
|
|
yield (parlamentar, False) |
|
|
yield (parlamentar, False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PresencaView(FormMixin, PresencaMixin, SessaoCrud.CrudDetailView): |
|
|
class PresencaView(FormMixin, PresencaMixin, SessaoCrud.DetailView): |
|
|
template_name = 'sessao/presenca.html' |
|
|
template_name = 'sessao/presenca.html' |
|
|
form_class = PresencaForm |
|
|
form_class = PresencaForm |
|
|
|
|
|
model = SessaoPlenaria |
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
def post(self, request, *args, **kwargs): |
|
|
self.object = self.get_object() |
|
|
self.object = self.get_object() |
|
@ -96,7 +114,7 @@ class PresencaView(FormMixin, PresencaMixin, SessaoCrud.CrudDetailView): |
|
|
return reverse('sessao:presenca', kwargs={'pk': pk}) |
|
|
return reverse('sessao:presenca', kwargs={'pk': pk}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PainelView(SessaoCrud.CrudDetailView): |
|
|
class PainelView(TemplateView): |
|
|
template_name = 'sessao/painel.html' |
|
|
template_name = 'sessao/painel.html' |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2238,12 +2256,6 @@ class PautaSessaoDetailView(SessaoCrud.CrudDetailView): |
|
|
return self.render_to_response(context) |
|
|
return self.render_to_response(context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SessaoCadastroView(CreateView): |
|
|
|
|
|
template_name = "sessao/sessao_cadastro.html" |
|
|
|
|
|
form_class = SessaoForm |
|
|
|
|
|
success_url = reverse_lazy('sessao:list_sessao') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SessaoPlenariaView(generics.ListAPIView): |
|
|
class SessaoPlenariaView(generics.ListAPIView): |
|
|
queryset = SessaoPlenaria.objects.all() |
|
|
queryset = SessaoPlenaria.objects.all() |
|
|
serializer_class = SessaoPlenariaSerializer |
|
|
serializer_class = SessaoPlenariaSerializer |
|
|