#32676: Migration autodetector changes related_name for self-referential
ManyToManyField.
----------------------------------+------------------------------------
     Reporter:  Mariusz Felisiak  |                    Owner:  nobody
         Type:  Bug               |                   Status:  new
    Component:  Migrations        |                  Version:  4.0
     Severity:  Release blocker   |               Resolution:
     Keywords:                    |             Triage Stage:  Accepted
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+------------------------------------
Changes (by Simon Charette):

 * stage:  Unreviewed => Accepted


Comment:

 That seems like a flaw of `RelatedField.deconstruct` tbh, it should not
 include `related_name` and friends if it was not specified at
 initialization.

 I suggest we make `RelatedField.__init__` store `related_name` and
 `related_query_name` as `self._related_name` and
 `self._related_query_name` and use them instead of relying on
 `self.remote_field` in `deconstruct`. That's the approach we've taken for
 post-initialization alterable attributes in `Field`
 
[https://github.com/django/django/blob/4e5bbb6ef2287126badd32842b239f4a8a7394ca/django/db/models/fields/__init__.py#L169
 for example].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32676#comment:3>
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/065.78cd1b2d7d88b334cffaed8b706bdbc2%40djangoproject.com.

Reply via email to