From 2e61fb82f3d4f979c152229368cda742c8292dc5 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 15 Sep 2017 14:08:44 -0300 Subject: [PATCH] Fix #1292 info ordemdia expediente (#1480) * Fix #1292 * HOT FIX --- sapl/sessao/forms.py | 1 - sapl/sessao/views.py | 28 +++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index a31aee70a..5f2e8303c 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -158,7 +158,6 @@ class ExpedienteMateriaForm(ModelForm): def clean(self): cleaned_data = super(ExpedienteMateriaForm, self).clean() - if not self.is_valid(): return cleaned_data diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 86e7a03eb..cf3cab735 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -154,13 +154,31 @@ def abrir_votacao(request, pk, spk): reverse('sapl.sessao:' + redirect_url, kwargs={'pk': spk})) -def put_link_materia(context): +def customize_link_materia(context): for i, row in enumerate(context['rows']): materia = context['object_list'][i].materia url_materia = reverse('sapl.materia:materialegislativa_detail', kwargs={'pk': materia.id}) - - context['rows'][i][1] = (row[1][0], url_materia) + numeracao = materia.numeracao_set.first() + autoria = materia.autoria_set.filter( + primeiro_autor=True).first() + if autoria: + autor = autoria.autor + num_protocolo = materia.numero_protocolo + + title_materia = '''%s
+ Número de Processo: %s
+ Autor: %s
+ Número de Protocolo: %s
+ ''' % (url_materia, + row[1][0], + numeracao if numeracao else '', + autor if autor else '', + num_protocolo if num_protocolo else '') + + # Na linha abaixo, o segundo argumento é None para não colocar + # url em toda a string de title_materia + context['rows'][i][1] = (title_materia, None) return context @@ -229,7 +247,7 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - return put_link_materia(context) + return customize_link_materia(context) def get_rows(self, object_list): for obj in object_list: @@ -352,7 +370,7 @@ class ExpedienteMateriaCrud(MasterDetailCrud): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - return put_link_materia(context) + return customize_link_materia(context) def get_rows(self, object_list): for obj in object_list: