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
Add support for instance method reassignment when extra='allow'
#7683
Conversation
Deploying with Cloudflare Pages
|
Please review Reviews welcome - not super set on a given pattern / if we should even do this, just looking for feedback 😄 |
…tch __getattr__ pattern
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
What happens if the model is also frozen? |
Lol good question. I checked, and:
I think this is reasonable behavior for frozen models (i.e., frozen instances don't let you overwrite any attributes, not just fields/extra/etc.). And since it raises an error, if we did ever want to change this in the future it would be easier to justify in terms of backwards compatibility than going in the other direction (i.e., making a non-error into an error). |
Change Summary
Adding aligning the logic of
__setattr__
and__getattr__
whenextra=True
on a model's config.Related issue number
Fix #7631
Checklist
Selected Reviewer: @Kludex