从Django 1.11 迁移到 Django 2.2 后 AdminFileWidget 的 render 报错了:
TypeError: render() got an unexpected keyword argument 'renderer'
(41 additional frame(s) were not displayed)
...
File "django/template/base.py", line 993, in render
return render_value_in_context(output, context)
File "django/template/base.py", line 972, in render_value_in_context
value = str(value)
File "django/utils/html.py", line 388, in <lambda>
klass.__str__ = lambda self: mark_safe(klass_str(self))
File "django/forms/boundfield.py", line 33, in __str__
return self.as_widget()
File "django/forms/boundfield.py", line 93, in as_widget
renderer=self.form.renderer,
解决办法:
widgets.py 的路径:
../lib/python3.6/site-packages/django/forms/widgets.py -> 239 行左右