[Solved]-Django: Access Admin User in Python Shell

29👍

You can do something like this:

$ ./manage.py shell
> from django.contrib.auth.models import User
> from <profile_package>.models import Profile
> user = User.objects.get(username='<admin_user_name>')
> profile = Profile(user=user)
> profile.save()

Leave a comment