Hello Djangonauts,
I have a custom widget to create a kind of group list which ommits the
last "/" at the end of an input field.
Making html validation to fail.
The important code is here:
rendered_cb = cb.render(name, option_value)
print rendered_cb
output.append(u'<li><label for="id_%s">%s %s</label></li>' % (
option_label,
rendered_cb,
option_label)
)
...
return mark_safe(u'\n'.join(output))
The shell output gives me
<input type="checkbox" id="id_Geographie" value="11"
name="competences" />
<input type="checkbox" id="id_Histoire" value="10" name="competences" /
>
<input type="checkbox" id="id_Philo" value="9" name="competences" />
<input type="checkbox" id="id_Biologie" value="8" name="competences" /
>
Thats all good
But then HTML output after mark_safe takes this input "/" away
<li class="group_check_list">Langues
</li><li><label for="id_Anglais"><input id="id_Anglais" value="2"
name="competences" type="checkbox"> Anglais</label></li>
<li><label class="" style="" for="id_Espagnol"><input id="id_Espagnol"
value="3" name="competences" type="checkbox"> Espagnol</label></li>
<li><label style="" class="" for="id_Japonais"><input id="id_Japonais"
value="4" name="competences" type="checkbox"> Japonais</label></li>
If i do the safe as a filter it still remove the last /, what is the
solution ?
(for now not validating html is not the end of the world)
Greg.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---