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
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0ef8ee95-f592-4d6f-982d-7ee5af8834da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment