Compare strings

Hello everyone, am trying to compare two items which are string in my html but it seems both strings don’t match even though they are the same. Can anyone help me with an alternative?

The is my code:

{% for item in sub_categories %}
    {% for cat in categories %}
       {% if cat.name == item.parent_category %}
           //Do something
        {% endif %}
   {% endfor %}
{% endfor %}

Please show your models here - or the view, if these references aren’t coming directly from the model.
(We may end up needing the view as well, but we’ll start with the models.)

When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. This forces the forum software to keep your code properly formatted.
(I’ve taken the liberty of editing your original post for this.)

Du you think you might need to check against item.parent_category.name or something like this instead?