Make sure AUTH_USER_MODEL isn't a proxy model. Otherwise the migration will fail.
DRY: Putting the logic that determines the USER_MODEL to be used in migrations, in one function that can be reused.
Merge pull request #698 from caioariede/fix_migration_issue_proxy_models

Make sure AUTH_USER_MODEL isn't a proxy model. Otherwise the migration will fail.