I have the following code in my template (please note the if
statement):
{% for base in bases %}
<label class="checkbox">
<input name="base" value={{ base.id }} type="checkbox"
{% if base.id in selected_bases %}checked="checked" {% endif %}/>
<span>{{ base.name }}</span>
</label>
{% endfor %}
The selected_bases
variable is a list of unicoded strings: [u'3', u'1', u'5']
.
base.id
is an integer.
How can I make them the same type so that if
statement does what I need it to?