예제 #1
0
 def post(self):
     try:
         howto_manager = HowToManager()
         howto_manager.remove_howto_image(request.form)
         return {'message': 'How To Updated'}, 204
     except Exception as e:
         return {'message': 'Something went wrong'}, 500
예제 #2
0
 def delete(self, post_id):
     try:
         howto_manager = HowToManager()
         howto_manager.delete_howto(post_id)
         return {'message': 'How To Deleted'}, 204
     except Exception as e:
         return {'message': 'Something went wrong'}, 500
예제 #3
0
 def put(self):
     try:
         howto_form = request.form
         howto_manager = HowToManager()
         howto_manager.update_how_to(howto_form)
         return {'message': 'Post Updated'}, 204
     except Exception as e:
         return {'message': 'Something Went Wrong'}, 500
예제 #4
0
 def post(self):
     try:
         howto_manager = HowToManager()
         request_file = request.files['file'] if len(
             request.files) > 0 else None
         howto_manager.create_home_HowTo(request_file, request.form)
         return {'message': 'HowTo Created'}, 201
     except Exception as e:
         return {'message': 'Something went wrong'}, 500
예제 #5
0
 def post(self):
     try:
         file_list = []
         for image_file in request.files:
             file_list.append(request.files[image_file])
         howto_manager = HowToManager()
         howto_manager.add_howto_images(file_list, request.form)
         return {'message': 'Post Updated'}, 204
     except Exception as e:
         return {'message': 'Something went wrong'}, 500
예제 #6
0
 def get(self, howto_title):
     try:
         howto_manager = HowToManager()
         return howto_manager.get_single_howto(howto_title)
     except Exception as e:
         return {'message': 'Something Went Wrong'}, 500
예제 #7
0
 def get(self):
     try:
         howto_manager = HowToManager()
         return howto_manager.get_all_how_tos()
     except Exception as e:
         return {'message': 'Something Went Wrong'}, 500
예제 #8
0
 def get(self, post_id):
     try:
         howto_manager = HowToManager()
         return howto_manager.get_single_howto_admin(post_id), 200
     except Exception as e:
         return {'message': 'Something Went Wrong'}, 500