Proper handling of to_field in deconstruct for AUTH_USER_MODEL foreign key
|Reported by:||timo||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
to_field shouldn't appear in the migration for a ForeignKey to settings.AUTH_USER_MODEL, otherwise the migration isn't usable if settings.AUTH_USER_MODEL uses a primary key with a name different than 'id'.
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 this pull request.