Closed mitchdowney closed 11 years ago
Vince figured it out. We need to use {% if user.pk == candidate.user.pk %} instead. We're not sure why the pk is necessary, because Django's documentation seems to say {% user == candidate.user %} should work. We'll have to look into this a little more sometime...
I'm real perplexed by this issue. I was able to get something similar to work moderators, as now if the logged-in user is a moderator for an election they are viewing, the "Edit Election" button will appear in the header. The code I used to make that work is:
So I tried to make an "Edit Profile" button the same way, that would only appear if the logged-in user is a candidate in the election they are viewing. I can't fer the life of me figure out why this isn't working:
What's weirdest for me is that I can verify that the for loop for election.candidate_set.all is returning the username of all the candidates in the currently open election, and user is returning the username of the currently logged-in user. But regardless {% if user == candidate.user %} never seems to return a result of True.
Any ideas what I'm doing wrong?
The relevant pages are election_detail.html, logos.views, everyvote_mini.urls, and everyvote_mini.models.