Ticket 35453 fix m2m concrete #19701
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trac ticket number
ticket-35453
Branch description
This change ensures that ManyToManyField.concrete returns False, reflecting the fact that M2M fields do not correspond to a concrete database column. This aligns with expectations and avoids confusion when introspecting model fields.
A new test was added to assert that .concrete is False for M2M fields.
To support this behavior without breaking model field setup (where .concrete is unconditionally assigned), a property with a no-op setter was used that forces concrete to remain False even when Django tries to assign to it.
This avoids a crash during model initialization and ensures that schema-related logic (e.g., field lateration checks) treat M2M fields correctly.
Checklist
main
branch.