0001-wcs-file-display-in-card-detail-cell-50971.patch
combo/apps/wcs/templates/combo/wcs/card.html | ||
---|---|---|
11 | 11 |
{% if card %} |
12 | 12 |
<div> |
13 | 13 |
{% for field in schema.fields %} |
14 |
{% if 'varname' in field and field.varname %} |
|
14 |
{% if 'varname' in field and field.varname and field.type != 'file' %}
|
|
15 | 15 |
{% with card.fields|get:field.varname as value %} |
16 | 16 |
<p> |
17 | 17 |
<span class="label">{{ field.label }}</span> |
tests/test_wcs.py | ||
---|---|---|
185 | 185 |
{'label': 'Field A', 'varname': 'fielda', 'type': 'string'}, |
186 | 186 |
{'label': 'Field B', 'varname': 'fieldb', 'type': 'bool'}, |
187 | 187 |
{'label': 'Field C', 'varname': 'fieldc', 'type': 'date'}, |
188 |
{'label': 'Field D', 'varname': 'fieldd', 'type': 'file'}, |
|
188 | 189 |
{'label': 'Related', 'varname': 'related', 'type': 'item'}, |
189 | 190 |
{'label': 'Page', 'type': 'page'}, |
190 | 191 |
{'label': 'Comment', 'type': 'comment'}, |
... | ... | |
205 | 206 |
'fielda': 'a', |
206 | 207 |
'fieldb': True, |
207 | 208 |
'fieldc': '2020-09-28', |
209 |
'fieldd': {'filename': 'file.pdf', 'url': 'http://some-url.com/download?f=42'}, |
|
208 | 210 |
'related': 'Foo Bar', |
209 | 211 |
'related_raw': 42, |
210 | 212 |
'related_structured': {'id': 42, 'text': 'blah'}, |
... | ... | |
1456 | 1458 |
assert '<span class="label">Related</span>\n \n <span class="value">Foo Bar</span>' in result |
1457 | 1459 |
assert 'related_raw' not in result |
1458 | 1460 |
assert 'related_structured' not in result |
1461 |
assert 'Field D' not in result |
|
1459 | 1462 | |
1460 | 1463 | |
1461 | 1464 |
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send) |
1462 |
- |