#36239: ManyToManyField check error with invalid "to" when passing
through/through_fields
-------------------------------------+-------------------------------------
     Reporter:  Jordan Hyatt         |                    Owner:
                                     |  JaeHyuckSa
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (System         |                  Version:  5.1
  checks)                            |
     Severity:  Normal               |               Resolution:
     Keywords:  check                |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Tanishq):

 Fixes #36239: Prevents `AttributeError: 'str' object has no attribute
 '_meta'` in `ManyToManyField` when `to` is invalid with
 `through`/`through_fields`.

 - **Issue**: The validation framework assumed `related_model` was always
 resolved, causing a crash when it remained a string.
 - **Fix**: If `related_model` is a string, we handle it gracefully in
 `_check_relationship_model`.
 - **Test**: Added test in `tests/model_fields/tests.py` to confirm
 expected error messages (`E300`, `E339`).
 - **Impact**: Prevents crashes and ensures Django correctly raises
 validation errors instead.


 https://github.com/django/django/pull/19301
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36239#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070195c3815043-037dbc4f-71d6-4bf8-a285-013bce95b31b-000000%40eu-central-1.amazonses.com.

Reply via email to