Hello everybody,
could somebody help me
I try to do data migration. Migration uses User from auth. Django 1.10.4
def create_superuser(apps, schema_editor):
User = apps.get_model("auth", "User")
User.objects.create_superuser(username='admin', password='admin123admin', email='')
class Migration(migrations.Migration):
dependencies = [
('auth', '__latest__'),
]
operations = [
migrations.RunPython(create_superuser),
]
I got an error:
...
File "/Projects/django/src/testdb/migrations/0001_initial.py", line 10, in create_superuser
User.objects.create_superuser(username='admin', password='admin123admin', email='')
File "/Projects/django/venv/lib/python3.4/site-packages/django/contrib/auth/models.py", line 168, in create_superuser
return self._create_user(username, email, password, **extra_fields)
File "/Projects/django/venv/lib/python3.4/site-packages/django/contrib/auth/models.py", line 148, in _create_user
username = self.model.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'
I use standard User in my project and I need perform data migrations.
thank you in advance
Pavel