Changes between Initial Version and Version 1 of Ticket #31064, comment 5


Ignore:
Timestamp:
Apr 3, 2020, 1:48:33 PM (5 years ago)
Author:
Sanskar Jaiswal

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31064, comment 5

    initial v1  
    55> By a quick glance at the code it looks like it could be a SQLite only issue due to [https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L364 this particular line].
    66
    7 After I did a bit of digging, it seems like [https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L364 this particular line] was indeed the culprit. Instead of calling `related_objects` on `new_field.model._meta`, if we call `get_fields(forward=False, reverse=True, include_hidden=True)` on the same, the `ForeignKey` in the `through` Model changes its type according to the `ManyToManyField`.
     7After I did a bit of digging, it seems like [https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L364 this particular line] was indeed the culprit. Instead of calling `related_objects` on `new_field.model._meta`, if we call `_get_fields(forward=False, reverse=True, include_hidden=True)` on the same, the `ForeignKey` in the `through` Model changes its type according to the `ManyToManyField`.
Back to Top