@karthikr When rendering to the template: I have {% if has_tag %}Remove{% else %}Add{% endif %}. But it seems to never hit the else to show 'Remove'. Would you know how to make the check work?
@karthikr I'm sorry that's still confusing for me. I understand {{ has_tag }} would return a boolean value. But it doesn't in the template. I guess what I'm asking is, where does the if part of things come into the scenario? As to say, if its true or if it's false
@karthikr i'm rendering context['has_tag'] = has_tag to the template
well.. what you are doing is right {% if has_tag %}Remove{% else %}Add{% endif %} would check if has_tag is present or not, and show the result. One more thing I would check is if has_tag is indeed True, or False - do a print and check on the console
Also, you might just want to hardcode context['has_tag'] to True and False manually, and see if it is correctly showing on the template you might have interchanged the condition to show Remove v/s Add
do this {% for tag in top_tags | slice: 10 %}{% if tag in profile_tags %}Remove{% else %}Add{% endif %}{% endfor %}
You cannot have one check in your case. YOu need to check forindividual elements, and print Remove or Add depending on the element is present in profile_tags