Closed jayvdb closed 2 years ago
A bug that appears when calling super().formfield_for_dbfield(db_field, request, **kwargs) from another app code. request was added as argument in Django in 2015: django/django@dbb0df2 (v1.10)
super().formfield_for_dbfield(db_field, request, **kwargs)
In this case, the problem comes from https://pypi.org/project/sorl-thumbnail/ , due to this PR https://github.com/jazzband/sorl-thumbnail/pull/592
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 607, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/usr/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 231, in inner return view(request, *args, **kwargs) File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1638, in add_view return self.changeform_view(request, None, form_url, extra_context) File "/usr/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/usr/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1522, in changeform_view return self._changeform_view(request, object_id, form_url, extra_context) File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1555, in _changeform_view ModelForm = self.get_form(request, obj, change=not add) File "/usr/lib/python3.8/site-packages/fluent_contents/admin/placeholderfield.py", line 50, in get_form return super(PlaceholderFieldAdmin, self).get_form(request, obj=obj, **kwargs) File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 702, in get_form return modelform_factory(self.model, **defaults) File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 554, in modelform_factory return type(form)(class_name, (form,), form_class_attrs) File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 252, in __new__ fields = fields_for_model( File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 178, in fields_for_model formfield = formfield_callback(f, **kwargs) File "/usr/lib/python3.8/site-packages/sorl/thumbnail/admin/current.py", line 63, in formfield_for_dbfield return sup.formfield_for_dbfield(db_field, request, **kwargs) TypeError: formfield_for_dbfield() takes 2 positional arguments but 3 were given
A bug that appears when calling
super().formfield_for_dbfield(db_field, request, **kwargs)
from another app code. request was added as argument in Django in 2015: django/django@dbb0df2 (v1.10)In this case, the problem comes from https://pypi.org/project/sorl-thumbnail/ , due to this PR https://github.com/jazzband/sorl-thumbnail/pull/592