Commit b30bae41 authored by Davve's avatar Davve

完善用户

parent 04d2faa9
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# __author__ = "chenwei" # __author__ = "chenwei"
# Date: 2018/11/15 # Date: 2018/11/15
import json
from utils.base import APIView from utils.base import APIView
from utils.time_utils import generate_id from utils.time_utils import generate_id
...@@ -34,7 +35,7 @@ class UserUpdateOrCreate(APIView): ...@@ -34,7 +35,7 @@ class UserUpdateOrCreate(APIView):
def post(self, request): def post(self, request):
id = request.POST.get('id', '') id = request.POST.get('id', '')
user_id = request.POST.get('user_id', '') user_id = request.POST.get('user_id', '')
tag_ids = list(set(request.POST.get('tag_ids').split(','))) tag_ids = list(map(lambda x: x.split(":")[0], json.loads(request.POST.get('tags', '[]'))))
if not user_id: if not user_id:
user_id = generate_id() user_id = generate_id()
data = { data = {
...@@ -42,9 +43,9 @@ class UserUpdateOrCreate(APIView): ...@@ -42,9 +43,9 @@ class UserUpdateOrCreate(APIView):
'is_recommend': request.POST.get('is_recommend'), 'is_recommend': request.POST.get('is_recommend'),
'profile_pic': request.POST.get('avatar')[:-2], 'profile_pic': request.POST.get('avatar')[:-2],
'nick_name': request.POST.get('nick_name'), 'nick_name': request.POST.get('nick_name'),
'tag_ids': list(filter(lambda x: x, tag_ids)), 'tag_ids': tag_ids,
'is_puppet': request.POST.get('is_puppet'), 'is_puppet': request.POST.get('is_puppet'),
'city_id': request.POST.get('city'), 'city_id': request.POST.get('city', '').split(":")[0],
'phone': request.POST.get('phone'), 'phone': request.POST.get('phone'),
'email': request.POST.get('email'), 'email': request.POST.get('email'),
'gender': request.POST.get('gender'), 'gender': request.POST.get('gender'),
......
This diff is collapsed.
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