Example #1
0
 def get(self, request, params={}):
     service = MarksheetService()
     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"]})
Example #2
0
 def delete(self, request, params={}):
     service = MarksheetService()
     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"]})
Example #3
0
 def save(self, request, params={}):
     json_request = json.loads(request.body)
     r = self.form_to_model(Marksheet(), json_request)
     service = MarksheetService()
     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 #4
0
 def search(self, request, params={}):
     service = MarksheetService()
     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 #5
0
 def search(self, request, params={}):
     print("marksheet search is called")
     json_request = json.loads(request.body)
     if (json_request):
         params["rollNumber"] = json_request.get("rollNumber", None)
     service = MarksheetService()
     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["name"] = json_request.get("name", None)
            params["rollNumber"] = json_request.get("rollNumber", None)
            params["pageNo"] = json_request.get("pageNo", None)

        service = MarksheetService()
        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 get_service(self):
     return MarksheetService()