When Django creates a Form instance from a form class, the fields and widgets are copied instead of instantiated. This means that every field/widget must implement deepcopy properly to create clones of any references it holds.
Implement __deepcopy__ in the WidgetMixin and copy the forward list to prevent forwards from leaking into unrelated forms when using a common base class.
When Django creates a Form instance from a form class, the fields and widgets are copied instead of instantiated. This means that every field/widget must implement deepcopy properly to create clones of any references it holds.
Implement
__deepcopy__
in theWidgetMixin
and copy theforward
list to prevent forwards from leaking into unrelated forms when using a common base class.