def render_options(self, *args):
"""
Variation to DAL default, which adds selected_choices to choices
"""
selected_choices_arg = 1 if VERSION < (1, 10) else 0
# Filter out None values, not needed for autocomplete
selected_choices = [c for c in args[selected_choices_arg] if c]
if self.url:
all_choices = copy.copy(self.choices)
self.choices += [ (c, c) for c in selected_choices ]
self.filter_choices_to_render(selected_choices)
html = super(WidgetMixin, self).render_options(*args)
if self.url:
self.choices = all_choices
return html
widgets.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录