forms.py 文件源码

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

项目:stormtrooper 作者: CompileInc 项目源码 文件源码
def __init__(self, task, *args, **kwargs):
        super(ChoiceAnswerForm, self).__init__(*args, **kwargs)
        if task:
            qs = task.choices
            widget = forms.RadioSelect
            empty_label = None
            count = task.no_of_choices
            if count > settings.TASK_CHOICE_SELECT_CUTOFF:
                widget = forms.Select
                empty_label = BLANK_CHOICE_DASH[0][1]
            self.fields['answer'] = forms.ModelChoiceField(queryset=qs,
                                                           widget=widget,
                                                           empty_label=empty_label)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号