Beispiel #1
0
 def search(self, request, params={}):
     service = RoleService()
     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})
Beispiel #2
0
    def search(self, request, params={}):
        json_request = json.loads(request.body)
        if (json_request):
            params["name"] = json_request.get("name", None)
            params["pageNo"] = json_request.get("pageNo", None)

        service = RoleService()
        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})