Commit 4397819b authored by liuzheng712's avatar liuzheng712

user.update bug fix

parent ee443361
...@@ -423,7 +423,7 @@ def profile(request): ...@@ -423,7 +423,7 @@ def profile(request):
def change_info(request): def change_info(request):
header_title, path1, path2 = '修改信息', '用户管理', '修改个人信息' header_title, path1, path2 = '修改信息', '用户管理', '修改个人信息'
user_id = request.user.id user_id = request.user.id
user = User.objects.filter(id=user_id) user = User.objects.get(id=user_id)
error = '' error = ''
if not user: if not user:
return HttpResponseRedirect('/') return HttpResponseRedirect('/')
...@@ -443,8 +443,9 @@ def change_info(request): ...@@ -443,8 +443,9 @@ def change_info(request):
# if password != user.password: # if password != user.password:
# password = CRYPTOR.md5_crypt(password) # password = CRYPTOR.md5_crypt(password)
user.update(name=name, email=email) User.objects.filter(id=user_id).update(name=name, email=email)
User.objects.get(id=user_id).set_password(password) user.set_password(password)
user.save()
msg = '修改成功' msg = '修改成功'
return render_to_response('juser/change_info.html', locals(), context_instance=RequestContext(request)) return render_to_response('juser/change_info.html', locals(), context_instance=RequestContext(request))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment