Missing Widget Keyword Arguments on transition fields lead to MediaDefiningClass object argument after ** must be a mapping, not NoneType
Steps to reproduce:
- Create a new workflow
- Add states a and b
- Add a transition from a to b
- Add a field to the transition, choose the "Text Area" class (leave "Widget keyword arguments" empty)
Expected result:
Running the workflow and transitioning from a to b presents the form with the created form field.
Actual result:
A server error is displayed and the following error is shown in the logs:
mayan.apps.common.middleware.error_logging <418> [ERROR] "process_exception() line 17 Exception caught by request middleware; <WSGIRequest: GET '/workflows/documents/workflows/8/transitions/2/execute/'>, MediaDefiningClass object argument after ** must be a mapping, not NoneType"
Traceback (most recent call last):
File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/common/mixins.py", line 548, in dispatch
).dispatch(request, *args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/edit.py", line 133, in get
return self.render_to_response(self.get_context_data())
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/common/mixins.py", line 101, in get_context_data
context = super(ExtraContextMixin, self).get_context_data(**kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/common/mixins.py", line 443, in get_context_data
context = super(RedirectionMixin, self).get_context_data(**kwargs)
File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/edit.py", line 66, in get_context_data
kwargs['form'] = self.get_form()
File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/edit.py", line 33, in get_form
return form_class(**self.get_form_kwargs())
File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/common/forms.py", line 171, in __init__
)(**widget.get('kwargs', {}))
TypeError: MediaDefiningClass object argument after ** must be a mapping, not NoneType
Workaround:
Add this to the "Widget keyword arguments" field:
attrs:
rows: 3
Suggested solution:
Add the above as the default value for "Widget keyword arguments" or make the field required and document it well.