From 67519621ea925d84444b0cd3c8e7ceb42baf85e3 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Fri, 2 Dec 2016 09:49:38 -0200 Subject: [PATCH] =?UTF-8?q?Adiciona=20numera=C3=A7=C3=A3o=20ao=20detail=20?= =?UTF-8?q?da=20mat=C3=A9ria?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/materia/models.py | 5 ++--- sapl/materia/views.py | 35 +++-------------------------- sapl/templates/materia/layouts.yaml | 1 + 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 8bdd6eecb..48604629c 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -412,10 +412,9 @@ class Numeracao(models.Model): 'data_materia',) def __str__(self): - return _('Nº%(numero)s %(tipo)s - %(data)s') % { + return _('%(numero)s/%(ano)s') % { 'numero': self.numero_materia, - 'tipo': self.tipo_materia, - 'data': self.data_materia} + 'ano': self.data_materia.year} class Orgao(models.Model): diff --git a/sapl/materia/views.py b/sapl/materia/views.py index ed759f57e..5d1a71eb4 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -1,7 +1,6 @@ from datetime import datetime from random import choice from string import ascii_letters, digits -from django.views.generic import DetailView from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML @@ -17,11 +16,13 @@ from django.shortcuts import get_object_or_404, redirect from django.template import Context, loader from django.utils import formats from django.utils.translation import ugettext_lazy as _ -from django.views.generic import CreateView, ListView, TemplateView, UpdateView +from django.views.generic import (CreateView, DetailView, ListView, + TemplateView, UpdateView) from django.views.generic.base import RedirectView from django.views.generic.edit import FormView from django_filters.views import FilterView +import sapl from sapl.base.models import Autor, CasaLegislativa from sapl.compilacao.models import (STATUS_TA_EDITION, STATUS_TA_IMMUTABLE_RESTRICT, @@ -40,7 +41,6 @@ from sapl.protocoloadm.models import Protocolo from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, autor_modal, gerar_hash_arquivo, get_base_url, montar_row_autor) -import sapl from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, DocumentoAcessorioForm, MateriaLegislativaFilterSet, @@ -56,7 +56,6 @@ from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, TipoMateriaLegislativa, TipoProposicao, Tramitacao, UnidadeTramitacao) - OrigemCrud = Crud.build(Origem, '') TipoMateriaCrud = CrudAux.build( @@ -1033,34 +1032,6 @@ class MateriaLegislativaCrud(Crud): class DetailView(Crud.DetailView): - def get_context_data(self, **kwargs): - context = super().get_context_data() - data = {} - - if self.object.numeracao_set.all().count() > 1: - string = ' - ' - for n in self.object.numeracao_set.all(): - _str = str(n.numero_materia) + '/' + str( - n.ano_materia) + ' - ' - string += _str - - data = {'text': string, - 'span': 12, - 'verbose_name': 'Processo', - 'id': 'processo'} - - elif self.object.numeracao_set.all().count() == 1: - n = self.object.numeracao_set.first() - string = str(n.numero_materia) + '/' + str(n.ano_materia) - - data = {'text': string, - 'span': 12, - 'verbose_name': 'Processo', - 'id': 'processo'} - - context['view'].layout_display[0]['rows'].insert(3, data) - return context - @property def layout_key(self): return 'MateriaLegislativaDetail' diff --git a/sapl/templates/materia/layouts.yaml b/sapl/templates/materia/layouts.yaml index b7e43e7b1..99b91afa3 100644 --- a/sapl/templates/materia/layouts.yaml +++ b/sapl/templates/materia/layouts.yaml @@ -125,6 +125,7 @@ MateriaLegislativaDetail: - tipo ano numero - data_apresentacao numero_protocolo tipo_apresentacao - texto_original + - numeracao_set {% trans 'Outras Informações' %}: - apelido dias_prazo polemica - objeto regime_tramitacao em_tramitacao