Reputation: 1003
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?
Upvotes: 1
Views: 1365
Reputation: 1
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)
Upvotes: 0
Reputation: 20976
You need to set up a view and serializer around the user that include the is_admin flag.
Upvotes: 1