wcs: file display in card detail cell (#50971)
This commit is contained in:
parent
ee7deb4e7f
commit
c8cf439f59
|
@ -11,7 +11,7 @@
|
|||
{% if card %}
|
||||
<div>
|
||||
{% for field in schema.fields %}
|
||||
{% if 'varname' in field and field.varname %}
|
||||
{% if 'varname' in field and field.varname and field.type != 'file' %}
|
||||
{% with card.fields|get:field.varname as value %}
|
||||
<p>
|
||||
<span class="label">{{ field.label }}</span>
|
||||
|
|
|
@ -185,6 +185,7 @@ WCS_CARDDEF_SCHEMA = {
|
|||
{'label': 'Field A', 'varname': 'fielda', 'type': 'string'},
|
||||
{'label': 'Field B', 'varname': 'fieldb', 'type': 'bool'},
|
||||
{'label': 'Field C', 'varname': 'fieldc', 'type': 'date'},
|
||||
{'label': 'Field D', 'varname': 'fieldd', 'type': 'file'},
|
||||
{'label': 'Related', 'varname': 'related', 'type': 'item'},
|
||||
{'label': 'Page', 'type': 'page'},
|
||||
{'label': 'Comment', 'type': 'comment'},
|
||||
|
@ -205,6 +206,7 @@ WCS_CARD_DATA = {
|
|||
'fielda': 'a',
|
||||
'fieldb': True,
|
||||
'fieldc': '2020-09-28',
|
||||
'fieldd': {'filename': 'file.pdf', 'url': 'http://some-url.com/download?f=42'},
|
||||
'related': 'Foo Bar',
|
||||
'related_raw': 42,
|
||||
'related_structured': {'id': 42, 'text': 'blah'},
|
||||
|
@ -1456,6 +1458,7 @@ def test_card_cell_render(mock_send, context):
|
|||
assert '<span class="label">Related</span>\n \n <span class="value">Foo Bar</span>' in result
|
||||
assert 'related_raw' not in result
|
||||
assert 'related_structured' not in result
|
||||
assert 'Field D' not in result
|
||||
|
||||
|
||||
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send)
|
||||
|
|
Loading…
Reference in New Issue