From eb4f98620f131eb698adcc4c4878e08483f50ac5 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Wed, 21 Oct 2015 14:13:21 -0200 Subject: [PATCH] =?UTF-8?q?Add=20linsting=20for=20Proposicoes=20Incorporad?= =?UTF-8?q?as,=20N=C3=A3o=20Incorporadas=20e=20Recebidas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/models.py | 2 +- protocoloadm/views.py | 32 +++++++++--- .../proposicoes_incorporadas.html | 51 ++++++++++++++++++- .../proposicoes_naoincorporadas.html | 51 ++++++++++++++++++- .../proposicoes_naorecebidas.html | 51 ++++++++++++++++++- 5 files changed, 177 insertions(+), 10 deletions(-) diff --git a/materia/models.py b/materia/models.py index 0f7da6114..dce0035d0 100644 --- a/materia/models.py +++ b/materia/models.py @@ -451,7 +451,7 @@ class Proposicao(models.Model): status = models.CharField(blank=True, null=True, - max_length = 1, + max_length=1, choices=(('E', 'Enviada'), ('D', 'Devolvida'), ('I', 'Incorporada')), diff --git a/protocoloadm/views.py b/protocoloadm/views.py index b65db1934..188495f44 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -14,7 +14,7 @@ from django.views.generic.base import TemplateView from django.views.generic.edit import FormMixin from vanilla import GenericView -from materia.models import TipoMateriaLegislativa +from materia.models import Proposicao, TipoMateriaLegislativa from sapl.crud import build_crud from .models import (Autor, DocumentoAcessorioAdministrativo, @@ -449,7 +449,8 @@ class ProtocoloMateriaForm(forms.Form): widget=forms.Textarea, label='Ementa', required=True) autor = forms.CharField(label='Autor', required=True) observacao = forms.CharField(required=True, - widget=forms.Textarea, label='Observação') + widget=forms.Textarea, + label='Observação') class ProtocoloMateriaView(FormMixin, GenericView): @@ -485,7 +486,7 @@ class ProtocoloMateriaView(FormMixin, GenericView): protocolo.autor = Autor.objects.get(id=request.POST['autor']) protocolo.anulado = False protocolo.tipo_materia = TipoMateriaLegislativa.objects.get( - id=request.POST['tipo_materia']) + id=request.POST['tipo_materia']) protocolo.numero_paginas = request.POST['num_paginas'] protocolo.observacao = sub( ' ', ' ', strip_tags(request.POST['observacao'])) @@ -506,13 +507,32 @@ class ProposicaoReceberView(TemplateView): template_name = "protocoloadm/proposicao_receber.html" -class ProposicoesNaoRecebidasView(TemplateView): +class ProposicoesNaoRecebidasView(ListView): template_name = "protocoloadm/proposicoes_naorecebidas.html" + model = Proposicao + paginate_by = 10 + def get_queryset(self): + return Proposicao.objects.filter(data_envio__isnull=False, status='E') -class ProposicoesNaoIncorporadasView(TemplateView): + +class ProposicoesNaoIncorporadasView(ListView): template_name = "protocoloadm/proposicoes_naoincorporadas.html" + model = Proposicao + paginate_by = 10 + def get_queryset(self): + return Proposicao.objects.filter(data_envio__isnull=False, + data_devolucao__isnull=False, + status='D') -class ProposicoesIncorporadasView(TemplateView): + +class ProposicoesIncorporadasView(ListView): template_name = "protocoloadm/proposicoes_incorporadas.html" + model = Proposicao + paginate_by = 10 + + def get_queryset(self): + return Proposicao.objects.filter(data_envio__isnull=False, + data_recebimento__isnull=False, + status='I') diff --git a/templates/protocoloadm/proposicoes_incorporadas.html b/templates/protocoloadm/proposicoes_incorporadas.html index dfdbe2541..d46f0d43a 100644 --- a/templates/protocoloadm/proposicoes_incorporadas.html +++ b/templates/protocoloadm/proposicoes_incorporadas.html @@ -3,5 +3,54 @@ {% load crispy_forms_tags %} {% block detail_content %} - Proposições Incorporadas +

Proposições Incorporadas

+ + {% for p in object_list %} + + + + + + + {% endfor %} +
+ {{ p.data_envio|date:"d/m/Y" }} + + {{ p.tipo.descricao }} + + {{ p.descricao }} + + {{ p.autor }} +
+ {% if is_paginated %} + + {% endif %} {% endblock detail_content %} \ No newline at end of file diff --git a/templates/protocoloadm/proposicoes_naoincorporadas.html b/templates/protocoloadm/proposicoes_naoincorporadas.html index f879b9d6c..703390295 100644 --- a/templates/protocoloadm/proposicoes_naoincorporadas.html +++ b/templates/protocoloadm/proposicoes_naoincorporadas.html @@ -3,5 +3,54 @@ {% load crispy_forms_tags %} {% block detail_content %} - Receber Não Incorporadas +

Proposições Não Incorporadas

+ + {% for p in object_list %} + + + + + + + {% endfor %} +
+ {{ p.data_envio|date:"d/m/Y" }} + + {{ p.tipo.descricao }} + + {{ p.descricao }} + + {{ p.autor }} +
+ {% if is_paginated %} + + {% endif %} {% endblock detail_content %} \ No newline at end of file diff --git a/templates/protocoloadm/proposicoes_naorecebidas.html b/templates/protocoloadm/proposicoes_naorecebidas.html index e3fb2fa99..a43647d50 100644 --- a/templates/protocoloadm/proposicoes_naorecebidas.html +++ b/templates/protocoloadm/proposicoes_naorecebidas.html @@ -3,5 +3,54 @@ {% load crispy_forms_tags %} {% block detail_content %} - Proposições Não Recebidas +

Proposições Não Recebidas

+ + {% for p in object_list %} + + + + + + + {% endfor %} +
+ {{ p.data_envio|date:"d/m/Y" }} + + {{ p.tipo.descricao }} + + {{ p.descricao }} + + {{ p.autor }} +
+ {% if is_paginated %} + + {% endif %} {% endblock detail_content %} \ No newline at end of file