workflows: don't include "in listing" option for "display form" fields (#11453)
This commit is contained in:
parent
1373080b38
commit
cf83f44d51
|
@ -1555,6 +1555,33 @@ def test_workflows_edit_email_action(pub):
|
|||
resp = resp.form.submit('submit')
|
||||
assert 'error in template' in resp.body and 'unmatched [end]' in resp.body
|
||||
|
||||
def test_workflows_edit_display_form_action(pub):
|
||||
create_superuser(pub)
|
||||
role = create_role()
|
||||
Workflow.wipe()
|
||||
workflow = Workflow(name='foo')
|
||||
workflow.add_status(name='baz')
|
||||
workflow.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/workflows/1/')
|
||||
resp = resp.click('baz')
|
||||
|
||||
resp.forms[0]['type'] = 'Display a form'
|
||||
resp = resp.forms[0].submit()
|
||||
resp = resp.follow()
|
||||
|
||||
resp = resp.click('Display a form')
|
||||
resp = resp.click('Edit Fields')
|
||||
|
||||
resp.form['label'] = 'foobar'
|
||||
resp.form['type'] = 'Text (line)'
|
||||
resp = resp.form.submit()
|
||||
|
||||
resp = resp.follow()
|
||||
assert 'foobar' in resp.body
|
||||
resp = resp.click('Edit')
|
||||
assert not 'in_listing' in resp.form.fields.keys()
|
||||
|
||||
def test_workflows_variables(pub):
|
||||
create_superuser(pub)
|
||||
|
|
|
@ -50,14 +50,21 @@ class WorkflowFormFieldsFormDef(FormDef):
|
|||
def store(self):
|
||||
self.item.parent.parent.store()
|
||||
|
||||
|
||||
class WorkflowFormFieldDefPage(FieldDefPage):
|
||||
section = 'workflows'
|
||||
|
||||
def form(self):
|
||||
form = super(WorkflowFormFieldDefPage, self).form()
|
||||
form.remove('in_listing')
|
||||
return form
|
||||
|
||||
|
||||
class WorkflowFormFieldsDirectory(FieldsDirectory):
|
||||
section = 'workflows'
|
||||
support_import = False
|
||||
blacklisted_types = ['page']
|
||||
field_def_page_class = WorkflowFormFieldDefPage
|
||||
|
||||
|
||||
class FormWorkflowStatusItem(WorkflowStatusItem):
|
||||
|
|
Loading…
Reference in New Issue