It's not necessary to include the field name, the default behavior of
models.ForeignKey is to look up the primary key field name from the target
model.
from [https://github.com/django/django/pull/2840 this pull request].
--
Ticket URL: <https://code.djangoproject.com/ticket/22889>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Tim Graham <timograham@…>):
In [changeset:"68b89f4d13b69771b232c1fcb0fb598000b6eb98"]:
{{{
#!CommitTicketReference repository=""
revision="68b89f4d13b69771b232c1fcb0fb598000b6eb98"
[1.7.x] Removed 'to_field' from ForeignKey(settings.AUTH_USER_MODEL) in
admin's initial migration.
This enables using a custom user model with a primary key with a name
different than 'id'; refs #22889.
Backport of bcd2e6c697 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22889#comment:1>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"0b571753a89f2a7a34c76dea5ee81f821b980779"]:
{{{
#!CommitTicketReference repository=""
revision="0b571753a89f2a7a34c76dea5ee81f821b980779"
Fixed #22889: Unneeded to_field in fk.deconstruct causing swap issues
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22889#comment:2>
Comment (by Andrew Godwin <andrew@…>):
In [changeset:"e4c9ccdbb5295c952a0ca12f988ae1b2164b1623"]:
{{{
#!CommitTicketReference repository=""
revision="e4c9ccdbb5295c952a0ca12f988ae1b2164b1623"
[1.7.x] Fixed #22889: Unneeded to_field in fk.deconstruct causing swap
issues
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22889#comment:3>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"ee3b719a81e62751195853233813c198ab7b66bb" ee3b719a]:
{{{
#!CommitTicketReference repository=""
revision="ee3b719a81e62751195853233813c198ab7b66bb"
Refs #32675 -- Removed to_field from ForeignKeys in contrib apps'
migrations.
Refs #22889.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22889#comment:4>