0001-wcs-use-custom-title-as-card-cell-additional-label-6.patch
combo/apps/wcs/models.py | ||
---|---|---|
26 | 26 |
from django.forms import Select |
27 | 27 |
from django.forms import models as model_forms |
28 | 28 |
from django.template import Context, RequestContext, Template, TemplateSyntaxError, VariableDoesNotExist |
29 |
from django.utils.html import escape |
|
29 | 30 |
from django.utils.safestring import mark_safe |
30 | 31 |
from django.utils.text import slugify |
31 | 32 |
from django.utils.translation import ugettext_lazy as _ |
... | ... | |
778 | 779 |
return self.carddef_reference.split(':')[1] |
779 | 780 | |
780 | 781 |
def get_additional_label(self): |
781 |
if not self.cached_title: |
|
782 |
return |
|
783 |
return self.cached_title |
|
782 |
return escape(self.custom_title) or self.cached_title or None |
|
784 | 783 | |
785 | 784 | |
786 | 785 |
@register_cell_class |
tests/test_wcs.py | ||
---|---|---|
2356 | 2356 |
cell.title_type = 'manual' |
2357 | 2357 |
cell.custom_title = '<b>Foo bar {{ card.fields.fielda }}</b>' |
2358 | 2358 |
cell.save() |
2359 |
assert cell.get_additional_label() == '<b>Foo bar {{ card.fields.fielda }}</b>' |
|
2359 | 2360 |
result = cell.render(context) |
2360 | 2361 |
assert '<h2><b>Foo bar a</b></h2>' in result |
2361 | 2362 | |
2362 |
- |