I´m doing a service basic login, and I need to answer with code 200 and JSON in a Django view, but I don't know if is this the correct form using HttpResponse library?
def Login(email,password):
User=CUser()
if User.is_valid(email,password) :
user=User.find(email)
datos['Id'] = str(user['Id'])
datos['Name'] = user['Name']
datos['LastName'] = user ['LastName']
datos['Email'] = user ['Email']
return HttpResponse(json.dumps(data), content_type = "application/json",status_code = 200)
else:
return HttpResponse( content_type = "application/json",status_code = 400)
I will use this response in android login, , and for that i need the status codes like django return on console