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

        service = SubjectService()
        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})
Esempio n. 3
0
 def search(self,request, params = {}):
     json_request=json.loads(request.body)
     if(json_request):
         params["subjectName"]=json_request.get("subjectName",None)
                     
     service=SubjectService()
     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})
Esempio n. 4
0
    def search(self, request, params={}):
        json_request = json.loads(request.body)
        if (json_request):
            params["subjectName"] = json_request.get("subjectName", None)

        service = SubjectService()
        c = service.search(params)
        res = {}
        data = []
        courseList = CourseService().search(self.form)
        for x in c:
            for y in courseList:
                if x.course_ID == y.id:
                    x.courseName = y.courseName
                    print("ddddd----------->", x.courseName)
            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})