本文整理汇总了Python中django.forms.widgets.Select.render_options方法的典型用法代码示例。如果您正苦于以下问题:Python Select.render_options方法的具体用法?Python Select.render_options怎么用?Python Select.render_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.forms.widgets.Select
的用法示例。
在下文中一共展示了Select.render_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_options
# 需要导入模块: from django.forms.widgets import Select [as 别名]
# 或者: from django.forms.widgets.Select import render_options [as 别名]
def render_options(self, object_selected):
s = Select()
if self.t_widget == 'autocomplete':
choices = [(
getattr(object_selected, self.name_value[0]),
getattr(object_selected, self.name_value[1])
)]
return s.render_options(choices, (object_selected.id, ))
return s.render_options(self.get_choices(), (object_selected.id, ))
示例2: render_options
# 需要导入模块: from django.forms.widgets import Select [as 别名]
# 或者: from django.forms.widgets.Select import render_options [as 别名]
def render_options(self, choices, selected_choices):
"""Render all options in the set of choices."""
return Select.render_options(self, choices, selected_choices)