Django: Converting uuid value to a string in django template engine

Viewed 1858

I have this code of line that I need to be up and running.

<h4 class="page-header">
    {% if msg.sent_by_id == request.user.public_id|string %}
        {% if request.user.role == 'administrator' %}Admin Replied
        {% elif request.user.role == 'user' %}Your reply
        {% endif %}
    {% endif %}
</h4>

The problem is that these two values are the same, BUT both of them are other format. msg.sent_by_id is a string, neither request.user.public_id, this value is in uuid format. What is the correct way of 'converting' an variable to a string and then comparing the two values?

1 Answers
Related