Commit cb5e01c0 authored by 王浩's avatar 王浩

fix some code

parent d94da631
...@@ -116,7 +116,7 @@ class TopicUpdateOrCreateView(APIView): ...@@ -116,7 +116,7 @@ class TopicUpdateOrCreateView(APIView):
def post(self, request): def post(self, request):
id = request.POST.get('id', '') id = request.POST.get('id', '')
topic_images = list(map(lambda x: x[:-2], json.loads(request.POST.get('topic_images', [])))) 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', '[]')))) 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', '[]')))) collection_tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('collection_tags', '[]'))))
pictorial_ids = list(json.loads(request.POST.get('pictorial_ids', '[]'))) pictorial_ids = list(json.loads(request.POST.get('pictorial_ids', '[]')))
...@@ -126,14 +126,14 @@ class TopicUpdateOrCreateView(APIView): ...@@ -126,14 +126,14 @@ class TopicUpdateOrCreateView(APIView):
'video_url': request.POST.get('video_url', ''), 'video_url': request.POST.get('video_url', ''),
'posting_time': request.POST.get('posting_time'), 'posting_time': request.POST.get('posting_time'),
'content': request.POST.get('content', ''), 'content': request.POST.get('content', ''),
'content_level': request.POST.get('content_level', ''), 'content_level': request.POST.get('content_level', 0),
'pictorial_ids': pictorial_ids, 'pictorial_ids': pictorial_ids,
'user_id': request.POST.get('user', '').split(':')[0], 'user_id': request.POST.get('user', '').split(':')[0],
'star_id': request.POST.get('star', '').split(':')[0], 'star_id': request.POST.get('star', '').split(':')[0],
'tag_ids': tag_ids, 'tag_ids': tag_ids,
'collection_tag_ids': collection_tag_ids, 'collection_tag_ids': collection_tag_ids,
'is_online': int(request.POST.get('is_online')), 'is_online': int(request.POST.get('is_online', 0)),
'drop_score': int(request.POST.get('drop_score')), 'drop_score': int(request.POST.get('drop_score', 0)),
'has_image': 1 if topic_images else 0, 'has_image': 1 if topic_images else 0,
'has_video': 1 if request.POST.get('video_url', '') else 0, 'has_video': 1 if request.POST.get('video_url', '') else 0,
'is_home': int(request.POST.get('is_home', 0)), 'is_home': int(request.POST.get('is_home', 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