wcs: fix card rendering with missing varname in custom_schema (#68598)
This commit is contained in:
parent
202c614849
commit
d1b26246b7
|
@ -37,6 +37,7 @@
|
|||
{% endwith %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.varname %}
|
||||
{% with fields_by_varnames|get:item.varname as field %}
|
||||
{% if field %}
|
||||
{% with card.fields|get:item.varname as value %}
|
||||
|
@ -60,6 +61,7 @@
|
|||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor%}
|
||||
</div>
|
||||
|
|
|
@ -1291,6 +1291,16 @@ def test_card_cell_card_mode_render_custom_schema_card_field(mock_send, context)
|
|||
assert PyQuery(result).find('.value a').text() == 'https://www.example.net/'
|
||||
assert PyQuery(result).find('.value a').attr['href'] == 'https://www.example.net/'
|
||||
|
||||
# wrong configuration, missing varname
|
||||
cell.custom_schema['cells'][0] = {
|
||||
'field_content': 'label-and-value',
|
||||
'display_mode': 'text',
|
||||
}
|
||||
cell.save()
|
||||
result = cell.render(context)
|
||||
assert PyQuery(result).find('.label') == []
|
||||
assert PyQuery(result).find('.value') == []
|
||||
|
||||
|
||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||
def test_card_cell_card_mode_render_custom_schema_card_empty_field(mock_send, context):
|
||||
|
|
Loading…
Reference in New Issue