[Solved] Issue with Django template ‘ifequal’ [closed]


You need to compare to a string. Use this:

{% ifequal smart_str(username).strip() "AnonymousUser" %}

Here’s the Django documentation on checking equality with ifequal.

Ensure your variable is a string, and one that’s trimmed of leading and trailing whitespaces as well.

5

solved Issue with Django template ‘ifequal’ [closed]