You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you override a Field’s constructor, to maintain consistent behavior, you should design your constructor so that:
You take label=’‘, validators=None as the first two positional arguments
Problem
This doesn't maintain consistent behavior. It results in no text being rendered if no label is provided instead of the default behavior of capitalizing the variable name of the field (username -> Username, first_name -> First Name, etc.).
Solution
Update the documentation to state that the constructor's label parameter should have None as its default value. This produces the expected behavior and is consistent with the Field base class.
The text was updated successfully, but these errors were encountered:
Background
Fields With Custom Constructors indicates that an empty string should be the default value for the label parameter.
This is directed implicitly in the code sample:
and explicitly after the code sample:
Problem
This doesn't maintain consistent behavior. It results in no text being rendered if no label is provided instead of the default behavior of capitalizing the variable name of the field (
username -> Username
,first_name -> First Name
, etc.).Solution
Update the documentation to state that the constructor's label parameter should have
None
as its default value. This produces the expected behavior and is consistent with theField
base class.The text was updated successfully, but these errors were encountered: