def search(self, request, params={}): json_request = json.loads(request.body) if (json_request): params["collegeName"] = json_request.get("collegeName", None) params["pageNo"] = json_request.get("pageNo", None) service = CollegeService() c = service.search(params) res = {} if (c != None): res["data"] = c["data"] res["error"] = False res["message"] = "Data is found" else: res["error"] = True res["message"] = "record not found" return JsonResponse({"result": res})
def search(self,request, params = {}): json_request=json.loads(request.body) params["collegeName"]=json_request["collegeName"] params["collegeName"]=json_request["collegeName"] service=CollegeService() c=service.search(params) res={} data=[] for x in c: data.append(x.to_json()) if(c!=None): res["data"]=data res["error"]=False res["message"]="Data is found" else: res["error"]=True res["message"]="record not found" return JsonResponse({"data":res})