Задать вопрос

Тел: +7 965 3737 888

375

Просмотров

0

Ответов

Split a string to a list and add to select options

The template filter is use for split a string such as "foo|foobar|bar" to select option widget. You can define the splitter of the string by yourself.

Usage: Add the code into templatetags folder of a installed app, then add below code into your template file.

` {% load split_as_option %}

<select name="widget_name"> {{ QuerySet.values|split_as_option:"|" }} </select> `

Вопрос полезен? Да0/Нет0
file_2775.py(585.0б)
None