I'm making a wishlist-type site where the row with the user's last change is highlighted. However, I'm having trouble doing that, as apparently using '==' on a context variable and the object's ID is not returning true, despite them both looking the same.
For example, this is the render
call I'm making:
def wishlist(request):
...
user_change = request.COOKIES.get('voted_or_added', False)
return render(request, 'xbox_wishlist/wishlist.html', { 'user_change': user_change, })
Then in my template, I have:
...
<tbody>
{% for game in ranked_wishlist %}
{% if user_change == game.id %}
<tr style="background: #80FF80;">
{% else %}
<tr>
{% endif %}
...
I've tried showing both {{ game.id }}
and {{ user_change }}
, and they both show the same number at the correct place, but that if
statement's predicate doesn't appear to be evaluating to True ever. I've tried replacing the ==
with in
, I've tried swapping their positions, I've tried everything but nothing seems to work.
Any ideas?