def showUsers(): if request.method == 'POST': return UserHandler().addUser(request.form) else: if not request.args: return UserHandler().getAllUser() else: return UserHandler().userSearch(request.args)
def get(self,request,username,requestId): try: user=UserHandler(username) if user.user is not None: userRequest = user.getRequests(requestId) return HttpResponse(json.dumps({"request":userRequest,"status":1})) else: return HttpResponse(json.dumps({"message":"please register and use the app"})) except: return HttpResponse(json.dumps({"message":"Its no good","status":0}))
def get(self,request,username): # try: user=UserHandler(username) # print user.user if user.user is not None: requests = user.getRequests() return HttpResponse(json.dumps({"status":"1","user_requests":requests})) else: return HttpResponse(json.dumps({"message":"Its no good"}))
def get(self,request,username): try: # print "In user Object" user= UserHandler(username) if user.user is not None: # print user.getUser() u=user.getUser() return HttpResponse(json.dumps({"user":u,"status":"success"})) else: return HttpResponse(json.dumps({"message":"User does not exist or try correct username","status":"success"})) except ObjectDoesNotExist: return HttpResponse(json.dumps({"message":"User does not exist or try correct username","status":"success"}))
def getUserRequested(uid): return UserHandler().getResourceRequest(uid)
def getUserBought(uid): return UserHandler().getResourceBought(uid)
def getUserTransacactions(uid): return UserHandler().getUserTransaction(uid)
def userPay(): return UserHandler().userPay(request.form)
def userRequests(): return UserHandler().createRequest(request.form)
def getUserCards(uid): return UserHandler().getCardbyID(uid)
def userCards(): return UserHandler().updateUserCreditCard(request.form)
def getUser(uid): return UserHandler().getUserbyId(uid)