From 08e26cbf23da43f7f3218dbbf958f56535231cc0 Mon Sep 17 00:00:00 2001 From: Patrick McAndrew Date: Wed, 22 Jan 2014 17:12:27 +0000 Subject: [PATCH] add api call to add user profile --- seahub/api2/views.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/seahub/api2/views.py b/seahub/api2/views.py index a78c38e180..f19fd38898 100644 --- a/seahub/api2/views.py +++ b/seahub/api2/views.py @@ -196,6 +196,19 @@ class Account(APIView): serializer.object['is_staff'], serializer.object['is_active']) + name = request.DATA.get("name", None) + note = request.DATA.get("note", None) + if name or note: + try: + profile = Profile.objects.get(user=user.username) + except Profile.DoesNotExist: + profile = Profile() + + profile.user = user.username + profile.nickname = name + profile.intro = note + profile.save() + if update: resp = Response('success') else: