Browse Source

Adiciona tele de proposições dentro de parlamentar

pull/548/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
af0df59007
  1. 4
      sapl/parlamentares/urls.py
  2. 33
      sapl/parlamentares/views.py
  3. 2
      sapl/templates/parlamentares/subnav.yaml

4
sapl/parlamentares/urls.py

@ -6,6 +6,7 @@ from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud,
MandatoCrud, MesaDiretoraView,
NivelInstrucaoCrud, ParlamentarCrud,
ParticipacaoParlamentarCrud, PartidoCrud,
ProposicaoParlamentarCrud,
SessaoLegislativaCrud,
TipoAfastamentoCrud, TipoDependenteCrud,
TipoMilitarCrud)
@ -18,7 +19,8 @@ urlpatterns = [
url(r'^parlamentar/', include(
ParlamentarCrud.get_urls() + DependenteCrud.get_urls() +
FiliacaoCrud.get_urls() + MandatoCrud.get_urls() +
ParticipacaoParlamentarCrud.get_urls()
ParticipacaoParlamentarCrud.get_urls() +
ProposicaoParlamentarCrud.get_urls()
)),
url(r'^coligacao/',
include(ColigacaoCrud.get_urls() +

33
sapl/parlamentares/views.py

@ -2,6 +2,7 @@ from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse, reverse_lazy
from django.shortcuts import redirect
from django.utils.datastructures import MultiValueDictKeyError
@ -13,6 +14,7 @@ from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudDeleteView, CrudDetailView, CrudListView,
CrudUpdateView)
from sapl.crud.masterdetail import MasterDetailCrud
from sapl.materia.models import Proposicao
from sapl.utils import permissao_tb_aux, permissoes_parlamentares
from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm,
@ -23,6 +25,37 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
SituacaoMilitar, TipoAfastamento, TipoDependente)
class ProposicaoParlamentarCrud(MasterDetailCrud):
model = Proposicao
parent_field = 'autor__parlamentar'
help_path = ''
class BaseMixin(CrudBaseMixin):
list_field_names = ['tipo', 'descricao']
class ListView(MasterDetailCrud.ListView):
permission_required = permissoes_parlamentares()
def get_queryset(self):
try:
proposicoes = Proposicao.objects.filter(
autor__parlamentar_id=self.kwargs['pk'],
data_envio__isnull=False)
except ObjectDoesNotExist:
return []
else:
return proposicoes
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_parlamentares()
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_parlamentares()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_parlamentares()
class ParticipacaoParlamentarCrud(MasterDetailCrud):
model = Participacao
parent_field = 'parlamentar'

2
sapl/templates/parlamentares/subnav.yaml

@ -9,3 +9,5 @@
url: dependente_list
- title: {% trans 'Comissões' %}
url: participacao_list
- title: {% trans 'Proposições' %}
url: proposicao_list

Loading…
Cancel
Save