how to limit number of super user in django
Question: In my django project, I want that there will be only one super user and no
more super users can be create by **python manage.py createsuperuser**

Is it possible? If possible how?


Answer: You can write a script to check number of superuser. Suppose you want 10
superusers then every time a superuser is created count if its more than 10 or
not and give error/success message accordingly.

You can count superusers as follows:

    
    
        from django.contrib.auth.models import User
        from django.http import HttpResponse
    
        user_obj = User.objects.all()
        c = 0
        for i in user_obj:
            if i.is_superuser():
                c += 1
    
        if c > 10:
            return HttpResponse('Cannot add anymore superusers')
        else:
            new_user  = User.objects.create_user(username = name, password = password)
    

of course you will have to make a form to accept username and password but I
have given the basic idea.  
You can also use python's `threading` library to make things async

