artinnok / django-swap-user

(Beta) Simple and flexible way to swap default Django User

Home Page:https://skonik.github.io/django-swap-user-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django admin exception: never_cache didn't receive an HttpRequest

skonik opened this issue · comments

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

  1. Install the latest django version
  2. add to INSTALLED_APPS
    "swap_user",
    "swap_user.to_phone_otp",
  1. Replace django.contrib.admin with swap_user.apps.OTPSiteConfig
  2. Set AUTH_USER_MODEL = "swap_to_phone_otp.PhoneOTPUser
  3. Open django admin login page

Screenshot

2022-06-13_13-34-19