コード例 #1
0
ファイル: widget.py プロジェクト: Python3pkg/NuPlone
def ChoiceWidgetFactory(field, request):
    vocabulary = getVocabulary(field)
    if vocabulary is None or len(vocabulary) > 4:
        widget = SelectWidget
    else:
        widget = SingleRadioWidget
    return FieldWidget(field, widget(request))
コード例 #2
0
def ChoiceWidgetFactory(field, request):
    vocabulary=getVocabulary(field)
    if vocabulary is None or len(vocabulary)>4:
        widget=SelectWidget
    else:
        widget=SingleRadioWidget
    return FieldWidget(field, widget(request))
コード例 #3
0
ファイル: widget.py プロジェクト: euphorie/tno.euphorie
def ChoiceWidgetFactory(field, request):
    """#1537: OSHA wants Choice fields to all look alike and all be radio
    buttons.

    NuPlone on the other hand has radio buttons for items<5 and dropdown
    otherwise.

    We increase min here
    """
    vocabulary = getVocabulary(field)
    if vocabulary is None or len(vocabulary) > 6:
        widget = SelectWidget
    else:
        widget = SingleRadioWidget
    return FieldWidget(field, widget(request))
コード例 #4
0
ファイル: widget.py プロジェクト: euphorie/osha.oira
def ChoiceWidgetFactory(field, request):
    """ #1537: OSHA wants Choice fields to all look alike and all be radio
        buttons.

        NuPlone on the other hand has radio buttons for items<5 and dropdown
        otherwise.

        We increase min here
    """
    vocabulary = getVocabulary(field)
    if vocabulary is None or len(vocabulary) > 6:
        widget = SelectWidget
    else:
        widget = SingleRadioWidget
    return FieldWidget(field, widget(request))