diff --git a/juser/user_api.py b/juser/user_api.py index 321006e79..d9d1022da 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -86,7 +86,7 @@ def db_update_user(**kwargs): groups_post = kwargs.pop('groups') admin_groups_post = kwargs.pop('admin_groups') user_id = kwargs.pop('user_id') - user = User.objects.get(id=user_id) + user = User.objects.filter(id=user_id) if user: pwd = kwargs.pop('password') user.update(**kwargs) diff --git a/juser/views.py b/juser/views.py index 005175b5a..09decb300 100644 --- a/juser/views.py +++ b/juser/views.py @@ -423,7 +423,7 @@ def profile(request): def change_info(request): header_title, path1, path2 = '修改信息', '用户管理', '修改个人信息' user_id = request.user.id - user = User.objects.get(id=user_id) + user = User.objects.filter(id=user_id) error = '' if not user: return HttpResponseRedirect('/') @@ -443,8 +443,8 @@ def change_info(request): # if password != user.password: # password = CRYPTOR.md5_crypt(password) - user.update(name=name, email=email) - user.set_password(password) + user.update(username=name, email=email) + User.objects.get(id=user_id).set_password(password) msg = '修改成功' return render_to_response('juser/change_info.html', locals(), context_instance=RequestContext(request))