Commit f864ce07 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'master'

sun user add roles fix topic create api add cut_word_tag_ids

See merge request alpha/sun!182
parents b5aaf6e5 24552ea0
......@@ -75,7 +75,10 @@ class LoginView(APIView):
'avatar': settings.AVATAR
})
if data['is_staff']:
data.update({'roles': ['staff']})
if data.get('staff_level'):
data.update({'roles': ['mbhoperator']})
else:
data.update({'roles': ['staff']})
else:
data.update({'roles': ['anonymous']})
except Exception as e:
......@@ -114,7 +117,10 @@ class LoginView(APIView):
error_logger.error(u'登陆失败%s', e)
raise
if data['is_staff']:
ret.update({'roles': ['staff']})
if data.get('staff_level'):
ret.update({'roles': ['mbhoperator']})
else:
ret.update({'roles': ['staff']})
else:
ret.update({'roles': ['anonymous']})
return {
......
......@@ -119,6 +119,7 @@ class TopicUpdateOrCreateView(APIView):
topic_images = list(map(lambda x: x[:-2], json.loads(request.POST.get('topic_images', '[]'))))
tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('tags', '[]'))))
collection_tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('collection_tags', '[]'))))
cut_word_tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('cut_word_tags', '[]'))))
pictorial_ids = list(json.loads(request.POST.get('pictorial_ids', '[]')))
data = {
......@@ -132,6 +133,7 @@ class TopicUpdateOrCreateView(APIView):
'star_id': request.POST.get('star', '').split(':')[0],
'tag_ids': tag_ids,
'collection_tag_ids': collection_tag_ids,
'cut_word_tag_ids': cut_word_tag_ids,
'is_online': int(request.POST.get('is_online', 0)),
'drop_score': int(request.POST.get('drop_score', 0)),
'has_image': 1 if topic_images else 0,
......
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