Opened 15 years ago
Closed 15 years ago
#13665 closed (invalid)
ifequal condition doesn't work in {% for %} variable
Reported by: | ramitos | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.1 |
Severity: | Keywords: | ifequal for variable | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Good evening,
I'm developping a select input loaded dynamically. I've stored the selected input in a variable and while the select it's being loaded, I check group variable on selMenuGroup variable, but it doesn't work.
{% for group in aGroups %}
<option{% ifequal selMenuGroup group %} selected{% endifequal %} value="{{ group }}">{{ group }}</option>
{% endfor %}
So, if I check on the variable content it works perfectly.
{% for group in aGroups %}
<option{% ifequal selMenuGroup 'group_content' %} selected{% endifequal %} value="{{ group }}">{{ group }}</option>
{% endfor %}
Thank you very much.
You haven't provided enough information to diagnose your problem (you would need to say what context data you are using to render the template, and what you expect to see, and what you actually see). If you can produce a test case, please re-open. I strongly suspect that this isn't a bug in Django and you are better off asking for help to fix your problem on django-users.
Thanks.