#31064: Migration doesn't detect precision changes in fields that ManyToMany 
points
to.
-----------------------------+------------------------------------------
     Reporter:  zapililirad  |                    Owner:  Simon Charette
         Type:  Bug          |                   Status:  assigned
    Component:  Migrations   |                  Version:  master
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Accepted
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+------------------------------------------

Comment (by Sanskar Jaiswal):

 Replying to [comment:6 Simon Charette]:
 > That makes sense, good old model level cache biting us again. If
 `related_objects` gets out of sync it's likely because we forgot to clear
 something in `AlterField.state_forwards` and my money is on
 `is_referenced_by_foreign_key` not taking into account `ManyToManyField`
 defined without an explicit `through` since that won't create any entry in
 `state.models`.
 Hey Simon,

 I don't know if this helps, but while I was playing around with this
 issue, calling `related_objects` on `new_field.model._meta`, always gave
 me an empty `ImmutableList`, but calling `_get_fields(forward=False,
 reverse=True, include_hidden=True)` gave me an `ImmutableList` of a
 `ManyToOneRel`. If we look at
 [https://github.com/django/django/blob/master/django/db/models/options.py#L508
 related_objects] right now, it only returns Relation objects which are not
 hidden or their field's `many_to_many` attribute is `True`. I am not quite
 sure whether this is intended or a bug though.

 Cheers
 Sanskar

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31064#comment:8>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/069.465c226401daa5c51e0e6f244f73dfd9%40djangoproject.com.

Reply via email to