From a369370e5cd2b3d8d813e11b76c00c24edd58060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Thu, 23 May 2019 12:41:10 -0300 Subject: [PATCH] =?UTF-8?q?Refatorar=20Mat=C3=A9ria=20Detail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/materia/views.py | 7 +++++ sapl/templates/materia/layouts.yaml | 1 - sapl/templates/materia/materia_detail.html | 36 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 sapl/templates/materia/materia_detail.html diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 075b1b270..241027f3a 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -1682,6 +1682,13 @@ class MateriaLegislativaCrud(Crud): class DetailView(Crud.DetailView): layout_key = 'MateriaLegislativaDetail' + template_name = "materia/materia_detail.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context['user'] = self.request.user + context['materia'] = MateriaLegislativa.objects.get(pk=self.kwargs['pk']) + return context class ListView(Crud.ListView, RedirectView): diff --git a/sapl/templates/materia/layouts.yaml b/sapl/templates/materia/layouts.yaml index 5db0f0223..44090e522 100644 --- a/sapl/templates/materia/layouts.yaml +++ b/sapl/templates/materia/layouts.yaml @@ -156,4 +156,3 @@ MateriaLegislativaDetail: - ementa - indexacao - observacao - - user ip diff --git a/sapl/templates/materia/materia_detail.html b/sapl/templates/materia/materia_detail.html new file mode 100644 index 000000000..ee1e97c9e --- /dev/null +++ b/sapl/templates/materia/materia_detail.html @@ -0,0 +1,36 @@ +{% extends "crud/detail.html" %} +{% load i18n %} + +{% block detail_content %} + {{ block.super }} + {% if user.is_superuser %} +
+ {% if materia.user %} +
+
+

Usuário

+
+ +
+
+
+ {% endif %} + {% if materia.ip %} +
+
+

IP

+
+
+
{{materia.ip}}
+
+
+
+
+ {% endif %} +
+ {% endif %} +{% endblock detail_content %}