From 50b95c0d8cc9650672a171ec8ac4507c769f0d5b Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Wed, 31 May 2017 12:24:29 -0300 Subject: [PATCH] Fix #1099 --- sapl/sessao/views.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 9fd048c43..19923caca 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -164,6 +164,16 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): class ListView(MasterDetailCrud.ListView): ordering = ['numero_ordem', 'materia', 'resultado'] + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + for i in range(len(context['rows'])): + materia = context['object_list'][i].materia + url_materia = reverse('sapl.materia:materialegislativa_detail', + kwargs={'pk': materia.id}) + + context['rows'][i][1] = (context['rows'][i][1][0], url_materia) + return context + def get_rows(self, object_list): for obj in object_list: exist_resultado = obj.registrovotacao_set.filter( @@ -280,11 +290,20 @@ class ExpedienteMateriaCrud(MasterDetailCrud): class ListView(MasterDetailCrud.ListView): ordering = ['numero_ordem', 'materia', 'resultado'] + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + for i in range(len(context['rows'])): + materia = context['object_list'][i].materia + url_materia = reverse('sapl.materia:materialegislativa_detail', + kwargs={'pk': materia.id}) + + context['rows'][i][1] = (context['rows'][i][1][0], url_materia) + return context + def get_rows(self, object_list): for obj in object_list: exist_resultado = obj.registrovotacao_set.filter( - materia=obj.materia - ).exists() + materia=obj.materia).exists() if not exist_resultado: if obj.votacao_aberta: url = ''