The documentation is a bit lacking with respect to this feature.
from django import forms
class TwoInputWidget(forms.MultiWidget):
"""An example widget which concatenates two text inputs with a space"""
def __init__(self, attrs=None):
widgets = [forms.TextInput, forms.TextInput]
Run Code Online (Sandbox Code Playgroud)
我可以看到我需要创建一个带有其他小部件列表的"小部件"属性,但之后它会得到一个小福尔摩斯.
有人请向我解释如何使用MultiWidget小部件吗?