Commit 52c22b6a authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'dev'

add pictorial topics api

See merge request alpha/sun!104
parents d020bdfc 9e6cb81b
......@@ -59,7 +59,25 @@ class PictorialUpdateOrCreate(APIView):
'icon': request.POST.get('icon', '')
}
try:
self.rpc['venus/sun/pictorial/edit'](id=id, data=data).unwrap()
error, data = self.rpc['venus/sun/pictorial/edit'](id=id, data=data).unwrap()
except Exception as e:
error_logger.error(u'编辑%s用户信息失败%s' % (id, e))
raise
return {
'message': '更新成功',
'data': data
}
class PictorialTopics(APIView):
"""创建画报和多个帖子关系"""
def post(self, request):
topic_ids = json.loads(request.POST.get('topic_ids', '[]'))
pictorial_id = request.POST.get('pictorial_id')
try:
self.rpc['venus/sun/pictorial/add_topics'](topic_ids=topic_ids, pictorial_id=pictorial_id).unwrap()
except Exception as e:
error_logger.error(u'编辑%s用户信息失败%s' % (id, e))
raise
......
......@@ -135,6 +135,7 @@ urlpatterns = [
url(r'^pictorial/list/update$', PictorialListView.as_view()),
url(r'^pictorial/get$', PictorialUpdateOrCreate.as_view()),
url(r'^pictorial/create$', PictorialUpdateOrCreate.as_view()),
url(r'^pictorial/topics$', PictorialTopics.as_view()),
]
search_urlpatterns = [
......
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