|
@@ -7,18 +7,18 @@ TYPE_URL_FOR = {'collection': 'collections.collection_list',
|
|
|
'blog': 'blogs.blog_list'}
|
|
|
|
|
|
|
|
|
-def create_content(data, image_data, type_):
|
|
|
+def create_content(data, image_data):
|
|
|
new_response = requests.post('http://127.0.0.1:5000/api/new_content', json=data)
|
|
|
if new_response.status_code == 200:
|
|
|
requests.post(
|
|
|
'http://127.0.0.1:5000/api/upload/static/img?type={}&filename={}'.format(
|
|
|
- type_, image_data.filename), files={'image': image_data})
|
|
|
+ data.get('type'), image_data.filename), files={'image': image_data})
|
|
|
sleep(0.5) # sleep for waiting for new_content API generating content successfully.
|
|
|
return redirect(url_for('editor.editor', url='/{}/{}'.format(
|
|
|
- type_, get_trans_title_url_name(data.get('name')))))
|
|
|
+ data.get('type'), get_trans_title_url_name(data.get('name')))))
|
|
|
else:
|
|
|
flash('新增文章失敗', 'danger')
|
|
|
- return redirect(url_for(TYPE_URL_FOR.get(type_)))
|
|
|
+ return redirect(url_for(TYPE_URL_FOR.get(data.get('type'))))
|
|
|
|
|
|
|
|
|
def remove_content():
|