0001-fields-display-page-with-single-comment-in-summary-5.patch
tests/form_pages/test_all.py | ||
---|---|---|
1460 | 1460 |
type='page', |
1461 | 1461 |
condition={'type': 'python', 'value': 'form_var_toto == "foo"'}, |
1462 | 1462 |
), |
1463 |
fields.TitleField(id='6', label='title in second page', type='title'), |
|
1463 |
fields.TitleField(id='6', label='title in second page', type='title', display_locations=[]),
|
|
1464 | 1464 |
fields.StringField(id='3', label='string'), |
1465 | 1465 |
fields.PageField(id='4', label='3rd page', type='page'), |
1466 | 1466 |
fields.StringField(id='5', label='string'), |
... | ... | |
1516 | 1516 |
assert '<h3>3rd page</h3>' in resp.text |
1517 | 1517 |
assert '<h3>4th page</h3>' not in resp.text |
1518 | 1518 | |
1519 |
formdef.fields[8].display_locations = ['summary'] |
|
1520 |
formdef.store() |
|
1521 |
resp = app.get('/test/') # -> 1st page |
|
1522 |
resp.form['f1'] = 'foo' |
|
1523 |
resp = resp.form.submit('submit') # -> 2nd page |
|
1524 |
resp.form['f3'] = 'bar' |
|
1525 |
resp = resp.form.submit('submit') # -> 3rd page |
|
1526 |
resp.form['f5'] = 'baz' |
|
1527 |
resp = resp.form.submit('submit') # -> 4th page |
|
1528 |
resp = resp.form.submit('submit') # -> validation |
|
1529 |
resp = resp.form.submit('submit') |
|
1530 |
resp = resp.follow() # -> submit |
|
1531 |
assert '<h3>1st page</h3>' in resp.text |
|
1532 |
assert '<h3>2nd page</h3>' in resp.text |
|
1533 |
assert '<h3>3rd page</h3>' in resp.text |
|
1534 |
assert '<h3>4th page</h3>' in resp.text |
|
1535 | ||
1519 | 1536 | |
1520 | 1537 |
def test_form_display_locations(pub): |
1521 | 1538 |
formdef = create_formdef() |
wcs/formdata.py | ||
---|---|---|
1326 | 1326 |
# ignore empty pages |
1327 | 1327 |
fields_and_details = [] |
1328 | 1328 |
for page in pages: |
1329 |
if not any(bool('value' in x) for x in page['fields']): |
|
1329 |
if not any( |
|
1330 |
bool(x['field'].type in ('title', 'subtitle', 'comment') or 'value' in x) |
|
1331 |
for x in page['fields'] |
|
1332 |
): |
|
1330 | 1333 |
continue |
1331 | 1334 |
fields_and_details.append(page) |
1332 | 1335 |
fields_and_details.extend([x for x in page['fields']]) |
1333 |
- |