From c8f0c1df0ad3a6a91839b0eba1beaade20460bee Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 10 Aug 2016 16:47:13 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20tela=20de=20proposi=C3=A7=C3=B5es=20?= =?UTF-8?q?pendentes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/materia/urls.py | 17 ++++++----- sapl/materia/views.py | 22 +++++++++++++- .../materia/prop_pendentes_list.html | 29 +++++++++++++++++++ 3 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 sapl/templates/materia/prop_pendentes_list.html diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index cda704b4a..1ed2aa431 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -8,13 +8,14 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, MateriaLegislativaCrud, MateriaLegislativaPesquisaView, MateriaTaView, NumeracaoCrud, OrgaoCrud, OrigemCrud, - ProposicaoCrud, ProposicaoTaView, - ReceberProposicao, ReciboProposicaoView, - RegimeTramitacaoCrud, RelatoriaCrud, - StatusTramitacaoCrud, TipoAutorCrud, - TipoDocumentoCrud, TipoFimRelatoriaCrud, - TipoMateriaCrud, TipoProposicaoCrud, - TramitacaoCrud, UnidadeTramitacaoCrud) + ProposicaoCrud, ProposicaoPendente, + ProposicaoTaView, ReceberProposicao, + ReciboProposicaoView, RegimeTramitacaoCrud, + RelatoriaCrud, StatusTramitacaoCrud, + TipoAutorCrud, TipoDocumentoCrud, + TipoFimRelatoriaCrud, TipoMateriaCrud, + TipoProposicaoCrud, TramitacaoCrud, + UnidadeTramitacaoCrud) from .apps import AppConfig @@ -36,6 +37,8 @@ urlpatterns = [ name='recibo-proposicao'), url(r'^proposicao/receber/', ReceberProposicao.as_view(), name='receber-proposicao'), + url(r'^proposicao/pendente/', ProposicaoPendente.as_view(), + name='proposicao-pendente'), # Integração com Compilação url(r'^materia/(?P[0-9]+)/ta$', diff --git a/sapl/materia/views.py b/sapl/materia/views.py index bfdb2b2e4..7fee82d91 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -11,7 +11,7 @@ from django.core.urlresolvers import reverse from django.http.response import HttpResponseRedirect from django.template import Context, loader from django.utils.translation import ugettext_lazy as _ -from django.views.generic import CreateView, TemplateView, UpdateView +from django.views.generic import CreateView, TemplateView, UpdateView, ListView from django.views.generic.edit import FormMixin from django_filters.views import FilterView @@ -102,6 +102,26 @@ class UnidadeTramitacaoCrud(Crud): form_class = UnidadeTramitacaoForm +class ProposicaoPendente(ListView): + template_name = 'materia/prop_pendentes_list.html' + model = Proposicao + ordering = ['data_envio', 'autor', 'tipo', 'descricao'] + paginate_by = 10 + + def get_queryset(self): + return Proposicao.objects.filter( + data_envio__isnull=False, data_recebimento__isnull=True) + + def get_context_data(self, **kwargs): + context = super(ProposicaoPendente, self).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context['NO_ENTRIES_MSG'] = 'Nenhuma proposição pendente.' + return context + + class ReceberProposicao(CreateView): template_name = "materia/receber_proposicao.html" form_class = ReceberProposicaoForm diff --git a/sapl/templates/materia/prop_pendentes_list.html b/sapl/templates/materia/prop_pendentes_list.html new file mode 100644 index 000000000..f36f3c3c2 --- /dev/null +++ b/sapl/templates/materia/prop_pendentes_list.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} +{% load i18n %} +{% block base_content %} + {% if not object_list %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + + {% for prop in object_list %} + + + + + + + {% endfor %} + +
Data de EnvioTipoDescriçãoAutor
{{ prop.data_envio|date:"d/m/Y H:i:s" }}{{ prop.tipo.descricao }}{{ prop.descricao }}{{ prop.autor }}
+ {% endif %} + {% include 'paginacao.html'%} +{% endblock %}