create admin user in django code example

Example 1: django admin create superuser

$ python manage.py createsuperuser

Example 2: django admin register

from django.contrib import admin
from .models import Author

@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
    pass

Example 3: django create user

from django.contrib.auth.models import User
user = User.objects.create_user(value['USERNAME'], value['EMAIL'], value['PASSWORD'])
user.first_name = value['NAME']
user.last_name = value['SURNAME']
user.save()

Example 4: wintp python manage.py createsuperuser

$ winpty python manage.py createsuperuser