wcs: use custom title as card cell additional label (#61040)
This commit is contained in:
parent
4244cfdd8f
commit
b5d82f30e4
|
@ -26,6 +26,7 @@ from django.db import models
|
|||
from django.forms import Select
|
||||
from django.forms import models as model_forms
|
||||
from django.template import Context, RequestContext, Template, TemplateSyntaxError, VariableDoesNotExist
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -783,9 +784,7 @@ class CardMixin:
|
|||
return self.carddef_reference.split(':')[1]
|
||||
|
||||
def get_additional_label(self):
|
||||
if not self.cached_title:
|
||||
return
|
||||
return self.cached_title
|
||||
return escape(self.custom_title) or self.cached_title or None
|
||||
|
||||
|
||||
@register_cell_class
|
||||
|
|
|
@ -2422,6 +2422,7 @@ def test_card_cell_render(mock_send, context, app):
|
|||
cell.title_type = 'manual'
|
||||
cell.custom_title = '<b>Foo bar {{ card.fields.fielda }}</b>'
|
||||
cell.save()
|
||||
assert cell.get_additional_label() == '<b>Foo bar {{ card.fields.fielda }}</b>'
|
||||
result = cell.render(context)
|
||||
assert '<h2><b>Foo bar a</b></h2>' in result
|
||||
|
||||
|
|
Loading…
Reference in New Issue