From bf3584bcf9ba6b29ef7d4ac341bd9984fc9e06ab Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 3 Oct 2011 21:19:35 +0200 Subject: [PATCH] use id for editUser --- pandora/user/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index 7f08f7a9..9929128e 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -315,8 +315,8 @@ def editUser(request): param data { key: value } - required key: username - optional keys: newUsername, email, level, note + required key: id + optional keys: username, email, level, note return { 'status': {'code': int, 'text': string} @@ -326,7 +326,7 @@ def editUser(request): ''' response = json_response() data = json.load(request.POST['data']) - user = get_object_or_404_json(models.User, username=data['username']) + user = get_object_or_404_json(models.User, username=data['id']) profile = user.get_profile() if 'email' in data: user.email = data['email'] @@ -334,8 +334,8 @@ def editUser(request): profile.set_level(data['level']) if 'note' in data: profile.note = data['note'] - if 'newUsername' in data: - user.username = data['newUsername'] + if 'username' in data: + user.username = data['username'] user.save() profile.save() return render_to_json_response(response)