def save(self, request, params={}): json_request = json.loads(request.body) r = self.form_to_model(Role(), json_request) service = RoleService() c = service.save(r) res = {} if (r != None): res["data"] = r.to_json() res["error"] = False res["message"] = "Data is Successfully saved" else: res["error"] = True res["message"] = "Data is not saved" return JsonResponse({"data": res})
def save(self, request, params={}): print("orsapi college save is run") json_request = json.loads(request.body) self.request_to_form(json_request) res = {} if (self.input_validation()): res["error"] = True res["message"] = "" else: r = self.form_to_model(Role(), json_request) service = RoleService() c = service.save(r) if (r != None): res["data"] = r.to_json() res["error"] = False res["message"] = "Data is Successfully saved" return JsonResponse({"data": res, 'form': self.form})