Example #1
0
    def search(self, request, params={}):
        print("tt search is found------------->")
        json_request = json.loads(request.body)
        if (json_request):
            params["subjectName"] = json_request.get("subjectName", None)
            params["semester"] = json_request.get("semester", None)
        service = TimeTableService()
        c = TimeTableService().search(params)
        print(params, " 1aaaaaaaaaaaaaaaa11111111111-->", c)

        res = {}
        data = []
        courseList = CourseService().search(self.form)
        subject_List = SubjectService().search(self.form)
        for x in c:
            for y in courseList:
                if x.course_ID == y.id:
                    x.courseName = y.courseName
            for z in subject_List:
                if x.subject_ID == z.id:
                    x.subjectName = z.subjectName
            print("mk")
            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})
 def get(self, request, params={}):
     service = TimeTableService()
     c = service.get(params["id"])
     res = {}
     if (c != None):
         res["data"] = c.to_json()
         res["error"] = False
         res["message"] = "Data is found"
     else:
         res["error"] = True
         res["message"] = "record not found"
     return JsonResponse({"data": res["data"]})
 def delete(self, request, params={}):
     service = TimeTableService()
     c = service.get(params["id"])
     res = {}
     if (c != None):
         service.delete(params["id"])
         res["data"] = c.to_json()
         res["error"] = False
         res["message"] = "Data is Successfully deleted"
     else:
         res["error"] = True
         res["message"] = "Data is not deleted"
     return JsonResponse({"data": res["data"]})
 def save(self, request, params={}):
     json_request = json.loads(request.body)
     r = self.form_to_model(TimeTable(), json_request)
     service = TimeTableService()
     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})
Example #5
0
 def search(self, request, params={}):
     service = TimeTableService()
     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})
Example #6
0
 def search(self,request, params = {}):
     json_request=json.loads(request.body)
     if(json_request):
         params["subjectName"]=json_request.get("subjectName",None)
         params["semester"]=json_request.get("semester",None)
         params["pageNo"]=json_request.get("pageNo",None)
  
     service=TimeTableService()        
     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)
        if (json_request):
            params["subjectName"] = json_request.get("subjectName", None)
            params["semester"] = json_request.get("semester", None)

        service = TimeTableService()
        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})
Example #8
0
 def get_service(self):
     return TimeTableService()