Skip to content

Commit

Permalink
User object is not the user, must update at the user (jumpserver#254)
Browse files Browse the repository at this point in the history
修改信息保存后数据不是最新的而是之前的数据,因为在object的惰性查询不会获取到最新的数据,因此需要在缓存的对象基础上修改save后commit到数据库。
  • Loading branch information
lrqrun authored and ibuler committed Jun 7, 2016
1 parent f130a78 commit b7be5d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion juser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b7be5d1

Please sign in to comment.