app/soc/models/seed_db.py
changeset 1945 ad3e6c4bb604
parent 1929 1ce28a2dd71f
child 2027 199bcab679df
equal deleted inserted replaced
1944:992ab773e3ff 1945:ad3e6c4bb604
    78   return account, current_user
    78   return account, current_user
    79 
    79 
    80 
    80 
    81 def seed(request, *args, **kwargs):
    81 def seed(request, *args, **kwargs):
    82   """Seeds the datastore with some default values.
    82   """Seeds the datastore with some default values.
    83 
    83   """
    84   Understands the following GET args:
       
    85     many_users: create 200 users instead of 15, out of which 100 have
       
    86         a e-mail address in the auth domain
       
    87     user_start: where to start adding new users at
       
    88     user_end: where to stop adding new users at
       
    89     user_goal: how many users to add in total, implies user_only
       
    90     user_step: how many users to add per request, defaults to 15
       
    91     user_only: stop after adding new users
       
    92     many_orgs: create 200 pre-accepted and 200 pre-denied org apps
       
    93         instead of just 1- pre-accepted ones, also create 200
       
    94         orgs instead of just 15.
       
    95 
       
    96     user is redirected to if user_end < user_goal, incrementing both
       
    97     user_start and user_end with user_step.
       
    98   """
       
    99 
       
   100   get_args = request.GET
       
   101 
       
   102 
    84 
   103   site_properties = {
    85   site_properties = {
   104       'key_name': 'site',
    86       'key_name': 'site',
   105       'link_id': 'site',
    87       'link_id': 'site',
   106       }
    88       }
   522 
   504 
   523   return all_properties
   505   return all_properties
   524 
   506 
   525 def seed_many(request, *args, **kwargs):
   507 def seed_many(request, *args, **kwargs):
   526   """Seeds many instances of the specified type.
   508   """Seeds many instances of the specified type.
       
   509 
       
   510     Understands the following GET args:
       
   511     start: where to start adding new users at
       
   512     end: where to stop adding new users at
       
   513     goal: how many users to add in total, implies user_only
       
   514     step: how many users to add per request, defaults to 15
       
   515     seed_type: the type of entity to seed, should be one of:
       
   516       user, org, org_app, mentor, student_proposal
       
   517 
       
   518     Redirects if end < goal, incrementing both start and end with step.
       
   519 
   527   """
   520   """
   528 
   521 
   529   get_args = request.GET
   522   get_args = request.GET
   530 
   523 
   531   if not dicts.containsAll(get_args, ['goal', 'start', 'end', 'seed_type']):
   524   if not dicts.containsAll(get_args, ['goal', 'start', 'end', 'seed_type']):