1

Hey i have one question about creating superuser with djangorestframework.

If i want to create superuser with console i'll write:

python manage.py createsuperuser

But now i want to create superuser with POST request using DRF 3.5

How should i do that if i'm using Android as a client for example?

2 Answers 2

1

You need to set up a view and serializer around the user that include the is_admin flag.

Sign up to request clarification or add additional context in comments.

Comments

0
from django.contrib.auth.models import User
    
def save_users(request):
        username = request.GET.get('username')
        email = request.GET.get('email')
        password = request.GET.get('password') 
        users = User.objects.create_user(username, email, password)

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.