From 860d755d63250c2b0c925d3092e95b24d75eec23 Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 17 Oct 2018 13:53:23 -0300 Subject: [PATCH] Fixes #2310 (#2311) --- sapl/audiencia/views.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sapl/audiencia/views.py b/sapl/audiencia/views.py index c999cf4ff..fa9084520 100644 --- a/sapl/audiencia/views.py +++ b/sapl/audiencia/views.py @@ -1,4 +1,5 @@ from django.http import HttpResponse +from django.core.urlresolvers import reverse from django.views.decorators.clickjacking import xframe_options_exempt from django.views.generic import UpdateView from sapl.crud.base import RP_DETAIL, RP_LIST, Crud @@ -23,6 +24,22 @@ class AudienciaCrud(Crud): class ListView(Crud.ListView): paginate_by = 10 + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + audiencia_materia = {} + for o in context['object_list']: + audiencia_materia[str(o.id)] = o.materia + + for row in context['rows']: + coluna_materia = row[3] # se mudar a ordem de listagem mudar aqui + if coluna_materia[0]: + materia = audiencia_materia[row[0][0]] + url_materia = reverse('sapl.materia:materialegislativa_detail', + kwargs={'pk': materia.id}) + row[3] = (coluna_materia[0], url_materia) + return context + class CreateView(Crud.CreateView): form_class = AudienciaForm