if userform.is_valid(): name = userform.cleaned_data['name'] email = userform.cleaned_data['email'] username = userform.cleaned_data['username'] password = userform.cleaned_data['password'] orgs = Organisation.objects.all()
# return render_to_response("userprofile/join_form.html", {'orgs': orgs, 'name': name, 'controls': controls, 'userform': userform, },context_instance=RequestContext(request)) for x in orgs: if x.title == name: return render_to_response("userprofile/join_form.html", {'name': name, 'controls': controls, 'userform': userform, },context_instance=RequestContext(request)) else: raise NameError("Missed") This bit ... if x.title == name: simple huh? if I run the same in a shell, >>> from directory.models import Organisation >>> name = "ANORG" >>>orgs = Organisation.objects.all() >>>for x in orgs: >>> if x.title == name: >>> name that works if I uncomment the render to response and do it in the template, {% for x in orgs %} {% ifequal x.title name %} {{ x.title }} {% endifequal %} {% endfor %} that works but for the life of me I cant see why in the actual view it decides that there is no match and goes to the else, it shouldn't, it should find a match!!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/245e8702-6483-4cd8-b526-68c8fbac0a4b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.