Django admin exception: never_cache didn't receive an HttpRequest
skonik opened this issue · comments
Sergei Konik commented
Description
Django admin login page throws exception while using swap_user.to_phone_otp
and swap_user.to_email_otp
with swap_user.apps.OTPSiteConfig
as a replace for django.contrib.admin
Exception
Internal Server Error: /admin/login/
Traceback (most recent call last):
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/views/decorators/debug.py", line 92, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/Users/sergeykonik/PycharmProjects/swap-user-test/.venv/lib/python3.9/site-packages/django/views/decorators/cache.py", line 58, in _wrapped_view_func
raise TypeError(
TypeError: never_cache didn't receive an HttpRequest. If you are decorating a classmethod, be sure to use @method_decorator.
Environment
Django version: 4.0.5
Python version: 3.9
Steps to reproduce
- Install the latest django version
- add to
INSTALLED_APPS
"swap_user",
"swap_user.to_phone_otp",
- Replace
django.contrib.admin
withswap_user.apps.OTPSiteConfig
- Set
AUTH_USER_MODEL = "swap_to_phone_otp.PhoneOTPUser
- Open django admin login page