def add_suggestions(payload): body = request.get_json() suggestion = body.get('suggestion', None) category = body.get('category', None) new_sug = Suggestion(suggestion=suggestion, category=category) new_sug.insert() all_suggestions = Suggestion.query.all() formatted_sugg = [sug.format() for sug in all_suggestions] return jsonify({'success': True, 'all_suggestion': formatted_sugg})