Home > other >  How to create api endpoint to create super user in django
How to create api endpoint to create super user in django

Time:12-25

Hey i have one question about creating superuser with djangorestframework. I want to create superuser with POST request using DRF 3.14

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

CodePudding user response:

Assuming you know what you are doing (superusers are quite powerful in Django), I suggest you include the following snippet in your DRF view:


from django.core import management

management.call_command('createsuperuser', **yourargs)

Full documentation can be found in the Django docs

  • Related