Commit 9e6cb81b authored by 王浩's avatar 王浩

add pictorial topics api

parent ba5e8f67
...@@ -59,7 +59,25 @@ class PictorialUpdateOrCreate(APIView): ...@@ -59,7 +59,25 @@ class PictorialUpdateOrCreate(APIView):
'icon': request.POST.get('icon', '') 'icon': request.POST.get('icon', '')
} }
try: 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: except Exception as e:
error_logger.error(u'编辑%s用户信息失败%s' % (id, e)) error_logger.error(u'编辑%s用户信息失败%s' % (id, e))
raise raise
......
...@@ -135,6 +135,7 @@ urlpatterns = [ ...@@ -135,6 +135,7 @@ urlpatterns = [
url(r'^pictorial/list/update$', PictorialListView.as_view()), url(r'^pictorial/list/update$', PictorialListView.as_view()),
url(r'^pictorial/get$', PictorialUpdateOrCreate.as_view()), url(r'^pictorial/get$', PictorialUpdateOrCreate.as_view()),
url(r'^pictorial/create$', PictorialUpdateOrCreate.as_view()), url(r'^pictorial/create$', PictorialUpdateOrCreate.as_view()),
url(r'^pictorial/topics$', PictorialTopics.as_view()),
] ]
search_urlpatterns = [ 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