Forms
have Fields
. Fields
have a Widget
. If a Field
name is omitted, it takes the variable name specified in the form. For example,
MyForm(Form):
username = Field(name=None, widget=MyWidget(args))
The field name would become "username". However, this can't be established until the form is constructed. Would it be so awful to set the field.name
attribute inside the form initializer, but after the field has already been constructed?
Similarly, would it be so awful to set some field.widget.xxx
attributes inside the form initializer to "pass in" some variables that are used in various functions inside the widget class? Or should I explicitly pass them in to each and every function call? Why?