I have an Django app which check if the the database holds numbers which matches the numbers entered by the user in the form. I've managed to get it to redirect to the 'You win' page if they do match but when they don't match it just gives an error saying 'matching query does not exist.' Here's the if/else statement I'm using in the view.py file:
if Numbers.objects.get(numbers_win = user_number):
return HttpResponseRedirect('win')
else:
return HttpResponseRedirect('lose.html')