I've been making user profile pages for my django site, but I cannot figure out where my logic is wrong in the following function. The problem is that I am trying to render different templates for when a visitor loads their own profile page, or another user's profile. Even if the request.user matches "name" (which is the string loaded from the url), it still renders the 2nd template. This means even when a = name, it does not return true. Can anyone tell me where the error is?
def profile2(request, name):
a = request.user
if a is name:
return render_to_response("profile.html", context_instance=RequestContext(request))
return render_to_response("diffprofile.html", {'name':name}, context_instance=RequestContext(request))