回到顶部

阅读目录

model_utils _clone() got an unexpected keyword argument 'subclasses'

发生环境

从 Django 1.11 迁移到 Django 2.2

错误日志

django.request: 2020-05-22 16:12:18,196 E:\py_virtualenv\joyoo\lib\site-packages\django\utils\log.py [line:228] ERROR Internal Server Error: /friendUrlAdd/
Traceback (most recent call last):
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "E:\yinzhuoqun\djangos\joyoo\blog\views.py", line 1151, in friend_url_add
    user = User.objects.get(pk=1)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\db\models\manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\db\models\query.py", line 399, in get
    clone = self.filter(*args, **kwargs)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\db\models\query.py", line 892, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\db\models\query.py", line 906, in _filter_or_exclude
    clone = self._chain()
  File "E:\py_virtualenv\joyoo\lib\site-packages\django\db\models\query.py", line 1219, in _chain
    obj = self._clone()
  File "E:\py_virtualenv\joyoo\lib\site-packages\model_utils\managers.py", line 100, in _clone
    return super(InheritanceQuerySetMixin, self)._clone(**kwargs)
TypeError: _clone() got an unexpected keyword argument 'subclasses'

解决办法

升级 django-model-utils

(joyoo) E:\yinzhuoqun\djangos\joyoo>pip install django-model-utils --upgrade
Collecting django-model-utils
  Downloading django_model_utils-4.0.0-py2.py3-none-any.whl (29 kB)
Requirement already satisfied, skipping upgrade: Django>=2.0.1 in e:\py_virtualenv\joyoo\lib\site-packages (from django-model-utils) (2.2.12)
Requirement already satisfied, skipping upgrade: pytz in e:\py_virtualenv\joyoo\lib\site-packages (from Django>=2.0.1->django-model-utils) (2017.2)
Requirement already satisfied, skipping upgrade: sqlparse in e:\py_virtualenv\joyoo\lib\site-packages (from Django>=2.0.1->django-model-utils) (0.3.0)
Installing collected packages: django-model-utils
  Attempting uninstall: django-model-utils
    Found existing installation: django-model-utils 3.0.0
    Uninstalling django-model-utils-3.0.0:
      Successfully uninstalled django-model-utils-3.0.0
Successfully installed django-model-utils-4.0.0

 

^_^
请喝咖啡 ×

文章部分资料可能来源于网络,如有侵权请告知删除。谢谢!

前一篇: ERROR: Pidfile (celerybeat.pid) already exists.
下一篇: django 2.2 django.core.exceptions.improperlyconfigured sqlite 3.8.3 or later is required (found 3.7.17)
captcha