I’m having a hard time trying to test weather a record in the database exists for a perticular ID in django.
something = User.objects.get(id=myID)
if something is None:
text="No Record"
I need to do something like this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since rev 11646 (3 months ago) django has a special function for that (see ticket 11402):
That is more efficient since it generates EXISTS sql statement instead of populating the python object.