I have created a custom user model for my project. I have written a data migration file to copy contents of auth.User to my new custom user table. It doesn\'t seem to work p
I solved this issue using below workaround,
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('custom_auth', '0001_initial'),
]
operations = [
migrations.RunSQL('INSERT INTO custom_auth_user SELECT * FROM auth_user'),
migrations.RunSQL('INSERT INTO custom_auth_user_groups SELECT * FROM auth_user_groups'),
migrations.RunSQL('INSERT INTO custom_auth_user_user_permissions SELECT * FROM auth_user_user_permissions'),
]
You should set AUTH_USER_MODEL = 'auth.User'
in settings.py
before run this migrate and after this migrate finishes, update the settings.py
to AUTH_USER_MODEL = 'custom_auth.User'