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
Fixed #35127 -- Made Model.full_clean() ignore GeneratedFields. #17758
Conversation
Thanks Claude Paroz for the report. Regression in f333e35.
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.
Nice quick fix ⭐
We've seen this pop up once before, I was almost going to suggest defining something alongside fields in a similar spirit to concrete_fields
though not sure it's worth it.
Are there any more instances of accessing fields
that we should check or have you checked already?
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 the quick fix!
Thanks both for checking 👍
Yes, there are a few places, but I don't think it's worth adding
I'll check other places, but even If I find something, it will be a separate bug. |
I wonder if this is a missed opportunity to branch of Per the docs these should be skipped during model validation. Is it not the case? |
I don't think that would work 🤔, because |
@felixxm what I meant is something like that diff --git a/django/db/models/base.py b/django/db/models/base.py
index 61925f63ea..ec0e975837 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1628,7 +1628,7 @@ def clean_fields(self, exclude=None):
errors = {}
for f in self._meta.fields:
- if f.name in exclude or f.generated:
+ if f.name in exclude or not f.editable:
continue
# Skip validation for empty fields with blank=True. The developer
# is responsible for making sure they have a valid value. which seems more correct based on the
And happens to resolve this issue as FWIW the full test suite passes on SQLite except for |
Right 👍 We can change this on the |
Agreed likely safer, I'll create a ticket about it and target |
Thanks Claude Paroz for the report.
Regression in f333e35.
ticket-35127