mirror of https://github.com/jumpserver/jumpserver
User object is not the user, must update at the user (#254)
修改信息保存后数据不是最新的而是之前的数据,因为在object的惰性查询不会获取到最新的数据,因此需要在缓存的对象基础上修改save后commit到数据库。pull/256/head
parent
f130a78f0a
commit
b7be5d14e0
|
@ -419,7 +419,9 @@ def change_info(request):
|
|||
error = '不能为空'
|
||||
|
||||
if not error:
|
||||
User.objects.filter(id=user_id).update(name=name, email=email)
|
||||
user.name = name
|
||||
user.email = email
|
||||
user.save()
|
||||
if len(password) > 0:
|
||||
user.set_password(password)
|
||||
user.save()
|
||||
|
|
Loading…
Reference in New Issue