0001-workflows-run-field-migrations-in-form-workflow-acti.patch
tests/test_workflows.py | ||
---|---|---|
2219 | 2219 |
assert 'Test' in str(form.widgets[0].render()) |
2220 | 2220 |
assert '<textarea' in str(form.widgets[1].render()) |
2221 | 2221 | |
2222 |
def test_display_form_migration(pub): |
|
2223 |
wf = Workflow(name='status') |
|
2224 |
st1 = wf.add_status('Status1', 'st1') |
|
2225 | ||
2226 |
display_form = FormWorkflowStatusItem() |
|
2227 |
display_form.id = '_x' |
|
2228 |
display_form.varname = 'xxx' |
|
2229 |
display_form.formdef = WorkflowFormFieldsFormDef(item=display_form) |
|
2230 |
display_form.formdef.fields = [ |
|
2231 |
ItemField(id='1', label='Test', type='item') |
|
2232 |
] |
|
2233 |
st1.items.append(display_form) |
|
2234 |
display_form.parent = st1 |
|
2235 | ||
2236 |
display_form.formdef.fields[0].show_as_radio = True |
|
2237 |
wf.store() |
|
2238 | ||
2239 |
wf = Workflow.get(wf.id) |
|
2240 |
assert wf.possible_status[0].items[0].formdef.fields[0].display_mode == 'radio' |
|
2241 | ||
2242 | ||
2222 | 2243 |
def test_choice_button_no_label(pub): |
2223 | 2244 |
role = Role(name='bar1') |
2224 | 2245 |
role.store() |
wcs/wf/form.py | ||
---|---|---|
109 | 109 |
def get_parameters(self): |
110 | 110 |
return ('by', 'varname', 'condition') |
111 | 111 | |
112 |
def migrate(self): |
|
113 |
changed = False |
|
114 |
if self.formdef and self.formdef.fields: |
|
115 |
for field in self.formdef.fields: |
|
116 |
changed |= field.migrate() |
|
117 |
return changed |
|
118 | ||
112 | 119 |
def export_to_xml(self, charset, include_id=False): |
113 | 120 |
item = WorkflowStatusItem.export_to_xml(self, charset, include_id=include_id) |
114 | 121 |
if not hasattr(self, 'formdef') or not self.formdef or not self.formdef.fields: |
115 |
- |