request.user
is not a character field, and it’s not the username, it’s a reference to an object. Hopefully, employee_number
is a field in the User
object, in which case your test would be:
{% if request.user.employee_number == entry.employee_number %}
What you see as the output of a print
statement, or from rendering something like {{ request.user }}
, is not the contents of the object itself. It’s intended to be a readable representation of that object.