Code

Ticket #5614: 5614.2.patch

File 5614.2.patch, 1.3 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('--email', dest='email', default=None, 
     10            help='Specifies the email address for the superuser.'), 
     11    ) 
     12    help = 'Used to create a superuser.' 
     13 
     14    def handle(self, *args, **options): 
     15        username = options.get('username', None) 
     16        email = options.get('email', None) 
     17 
     18        createsuperuser(username=username, password=None, email=email)