Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1333 clone forwards #1358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ercpe
Copy link

@ercpe ercpe commented Mar 23, 2024

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 the `WidgetMixin` and copy the `forward` list to prevent forwards from leaking into unrelated forms when using a common base class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant