我在django自带的auth_user 表中添加了一条用户信息
Traceback (most recent call last): File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py", line 124, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\hjz\Desktop\sweeper\sweeper\sweepintell\login\views.py", line 47, in login user = auth.authenticate(username=username, password=password ,usernum="",useraddperson="") File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\__init__.py", line 73, in authenticate user = backend.authenticate(request, **credentials) File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\backends.py", line 22, in authenticate if user.check_password(password) and self.user_can_authenticate(user): File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\base_user.py", line 111, in check_password return check_password(raw_password, self.password, setter) File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\hashers.py", line 50, in check_password must_update = hasher_changed or preferred.must_update(encoded) File "C:\Users\hjz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\hashers.py", line 267, in must_update algorithm, iterations, salt, hash = encoded.split('$', 3) ValueError: not enough values to unpack (expected 4, got 2)
我在models里重构了auth_user表,我测试不重写user表的时候没什么问题
重构user表时候models里定义字段username和password,冲突,注释后重新迁移数据库,问题解决