widgets.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:django-autocomplete-light-selectize 作者: litchfield 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号