diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py index 0f767cbea..adbaad6f4 100644 --- a/sapl/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -42,6 +42,26 @@ class ComposicaoCrud(MasterDetailCrud): model_set = 'participacao_set' public = [RP_LIST, RP_DETAIL, ] + class ListView(MasterDetailCrud.ListView): + template_name = "comissoes/composicao_list.html" + paginate_by = None + + def take_composicao_pk(self): + try: + return int(self.request.GET['pk']) + except: + return 0 + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context['composicao_pk'] = context['composicao_list'].first( + ).pk if self.take_composicao_pk( + ) == 0 else self.take_composicao_pk() + context['participacao_set'] = Participacao.objects.filter( + composicao__pk=context['composicao_pk'] + ).order_by('parlamentar') + return context + class ComissaoCrud(Crud): model = Comissao diff --git a/sapl/templates/comissoes/composicao_list.html b/sapl/templates/comissoes/composicao_list.html new file mode 100644 index 000000000..7d30ae875 --- /dev/null +++ b/sapl/templates/comissoes/composicao_list.html @@ -0,0 +1,69 @@ +{% extends "crud/list.html" %} +{% load i18n common_tags crispy_forms_tags%} + +{% block base_content %} +
Participações em Comissão | +Cargo | +Titular? | +Designação | +Desligamento | +Motivo | +Observações | +
---|---|---|---|---|---|---|
+ {{ p.parlamentar }} + | +{{p.cargo}} | +{{p.titular|yesno:"Sim,Não"}} | +{{p.data_designacao}} | +{{p.data_desligamento}} | +{{p.motivo}} | +{{p.observacao}} | +