Code

Ticket #5614: 5614.patch

File 5614.patch, 1.4 KB (added by Collin Grady <cgrady@…>, 7 years ago)
  • django/contrib/auth/management/commands/createsuperuser.py

     
     1from django.core.management.base import BaseCommand 
     2from optparse import make_option 
     3from django.contrib.auth.create_superuser import createsuperuser 
     4 
     5class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--username', dest='username', default=None, 
     8            help='Specifies the username for the superuser.'), 
     9        make_option('--password', dest='password', default=None, 
     10            help='Specifies the password for the superuser.'), 
     11        make_option('--email', dest='email', default=None, 
     12            help='Specifies the email address for the superuser.'), 
     13    ) 
     14    help = 'Used to create a superuser.' 
     15 
     16    def handle(self, *args, **options): 
     17        username = options.get('username', None) 
     18        password = options.get('password', None) 
     19        email = options.get('email', None) 
     20 
     21        createsuperuser(username=username, password=password, email=email) 
     22