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
Raise an error when deleting frozen (model) fields #7800
Conversation
please review |
@sydney-runkle I think it's interesting that the bot doesn't assign to you automatically since you were assigned to the linked issue. |
Indeed, we have some work to do with the hooky bot 😆 |
|
||
try: | ||
del model.x | ||
except ValidationError as exc: | ||
print(repr(exc.errors()[0]['type'])) | ||
#> 'frozen_field' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making sure to add a docs update as well 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well 👍
Change Summary
Extracted the validation logic for frozen fields/models in
__setattr__
into a new method_check_frozen
, deduplicated it a bit, and called it in__delattr__
which was previously incorrectly not checking this.Related issue number
Closes #7784
Checklist
Selected Reviewer: @dmontagu