From 64859f4837484adcec26ca374c817c6398b0b6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 22 Jul 2021 15:38:24 +0200 Subject: [PATCH] misc: add description to form & link cell contexts (#55776) --- combo/apps/wcs/models.py | 2 ++ combo/apps/wcs/templates/combo/wcs/form.html | 4 ++-- combo/data/models.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/combo/apps/wcs/models.py b/combo/apps/wcs/models.py index 9afa7cc3..c43e6b77 100644 --- a/combo/apps/wcs/models.py +++ b/combo/apps/wcs/models.py @@ -25,6 +25,7 @@ from django.contrib.postgres.fields import JSONField from django.db import models from django.forms import Select from django.forms import models as model_forms +from django.utils.safestring import mark_safe from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ from requests.exceptions import RequestException @@ -128,6 +129,7 @@ class WcsFormCell(CellBase): context['title'] = self.cached_title context['url'] = self.cached_url + 'tryauth' if self.cached_json: + context['description'] = mark_safe(self.cached_json.get('description', '')) context['css_classes'] = get_formdef_css_classes(self.cached_json) for attribute in self.cached_json: if not attribute in context: diff --git a/combo/apps/wcs/templates/combo/wcs/form.html b/combo/apps/wcs/templates/combo/wcs/form.html index 97be36b0..a70c5f22 100644 --- a/combo/apps/wcs/templates/combo/wcs/form.html +++ b/combo/apps/wcs/templates/combo/wcs/form.html @@ -1,8 +1,8 @@ {% block cell-content %}
{{ title }} -{% if cell.cached_json.description %} +{% if description %}
-{{ cell.cached_json.description|safe }} +{{ description }}
{% endif %}
diff --git a/combo/data/models.py b/combo/data/models.py index c6a1faf9..868a84e8 100644 --- a/combo/data/models.py +++ b/combo/data/models.py @@ -1399,6 +1399,7 @@ class LinkCell(CellBase): extra_context = super(LinkCell, self).get_cell_extra_context(context) if self.link_page: extra_context['title'] = self.title or self.link_page.title + extra_context['description'] = self.link_page.description else: extra_context['title'] = self.title or self.url url = self.get_url(context)