mercredi 25 février 2015

django views if statement not working with a boolean

My if statment always goes to the Else even if the boolean value changes? Working in Django 1.6.5


views.py


def awaiting_email_confirmation(request): confirmed = EmailConfirmed.objects.get(user=request.user) print confirmed if confirmed is False: print "if" template = 'accounts/email_confirmation.html' context = {} return render(request, template, context)

else: print "else" return HttpResponseRedirect(reverse("dashboard"))


My console will print


True else


False else


Aucun commentaire:

Enregistrer un commentaire