<s> from optparse import make_option <EOL> from django . core . management . base import BaseCommand <EOL> from landing . models import SEEDUser as User <EOL> from superperms . orgs . models import Organization , OrganizationUser <EOL> class Command ( BaseCommand ) : <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' , <EOL> type = '<STR_LIT:string>' , <EOL> dest = '<STR_LIT:username>' ) , <EOL> make_option ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' , <EOL> type = '<STR_LIT:string>' , <EOL> dest = '<STR_LIT:password>' ) , <EOL> make_option ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' , <EOL> type = '<STR_LIT:string>' , <EOL> dest = '<STR_LIT>' ) , <EOL> ) <EOL> help = '<STR_LIT>' <EOL> def handle ( self , * args , ** options ) : <EOL> if User . objects . filter ( username = options [ '<STR_LIT:username>' ] ) . exists ( ) : <EOL> self . stdout . write ( <EOL> '<STR_LIT>' % options [ '<STR_LIT:username>' ] , <EOL> ending = '<STR_LIT:\n>' <EOL> ) <EOL> u = User . objects . get ( username = options [ '<STR_LIT:username>' ] ) <EOL> else : <EOL> self . stdout . write ( <EOL> '<STR_LIT>' % ( <EOL> options [ '<STR_LIT:username>' ] , options [ '<STR_LIT:password>' ] <EOL> ) , ending = '<STR_LIT:U+0020>' <EOL> ) <EOL> u = User . objects . create_superuser ( <EOL> options [ '<STR_LIT:username>' ] , <EOL> options [ '<STR_LIT:username>' ] , <EOL> options [ '<STR_LIT:password>' ] <EOL> ) <EOL> self . stdout . write ( '<STR_LIT>' , ending = '<STR_LIT:\n>' ) <EOL> org , created = Organization . objects . get_or_create ( <EOL> name = options [ '<STR_LIT>' ] ) <EOL> if created : <EOL> self . stdout . write ( <EOL> '<STR_LIT>' % options [ '<STR_LIT>' ] , <EOL> ending = '<STR_LIT:\n>' <EOL> ) <EOL> else : <EOL> self . stdout . write ( <EOL> '<STR_LIT>' % options [ '<STR_LIT>' ] , ending = '<STR_LIT:\n>' <EOL> ) <EOL> self . stdout . write ( <EOL> '<STR_LIT>' , ending = '<STR_LIT:U+0020>' <EOL> ) <EOL> OrganizationUser . objects . create ( user = u , organization = org ) <EOL> self . stdout . write ( '<STR_LIT>' , ending = '<STR_LIT:\n>' ) </s>
