def feature_request_by_id_read(feature_request_id): try: feature_request = FeatureRequest(test=test_mode) feature_request = feature_request.find_by_id(feature_request_id) return jsonify(feature_request.to_dict()) except Exception, e: print e return e
def feature_requests_all_read(): try: feature_request = FeatureRequest(test=test_mode) feature_requests = feature_request.find_all() feature_requests_list = [] for feature_request in feature_requests: feature_requests_list.append(feature_request.to_dict()) return jsonify(feature_requests=feature_requests_list) except Exception, e: print e return e
def feature_request_add(): data = request.data data_dict = json.loads(data) feature_requests_dict = {} feature_request = FeatureRequest(test=test_mode) feature_request.title = data_dict['title'] feature_request.description = data_dict['description'] feature_request.client_name = data_dict['client_name'] feature_request.client_priority = data_dict['client_priority'] feature_request.target_date = data_dict['target_date'] feature_request.product_area = data_dict['product_area'] feature_request.agent_name = data_dict['agent_name'] feature_request.save() return jsonify({ 'status': 'success', 'message': 'Feature request added', 'feature_request': feature_request.to_dict() })