#NEWLINE# def build_test_schools( num_elements = 2 ) : #NEWLINE# #INDENT# 'Build a set of test schools for dev work.' #NEWLINE# num_elements = num_elements #NEWLINE# user = User . objects . filter ( username = os . environ [ 'RU_USERNAME' ] ) [ 0 ] #NEWLINE# su_user = User . objects . filter ( username = os . environ [ 'SU_USERNAME' ] ) [ 0 ] #NEWLINE# ( test_organizations , test_sas ) = ( [ ] , [ ] ) #NEWLINE# for organization_num in range ( 6 ) : #NEWLINE# #INDENT# name = li . get_words ( 2 ) #NEWLINE# if ( organization_num < ( num_elements / 2 ) ) : #NEWLINE# #INDENT# new_organization = Organization . objects . create ( name = name , owner = user ) #NEWLINE# new_organization . editors . add ( user ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_organization = Organization . objects . create ( name = name , owner = su_user ) #NEWLINE# new_organization . editors . add ( su_user ) #NEWLINE# #UNINDENT# test_organizations . append ( new_organization ) #NEWLINE# for sa_num in range ( num_elements ) : #NEWLINE# #INDENT# sa_name = li . get_words ( 2 ) #NEWLINE# new_sa = SubjectArea . objects . create ( subject_area = sa_name , organization = new_organization ) #NEWLINE# test_sas . append ( new_sa ) #NEWLINE# for gs_num in range ( num_elements ) : #NEWLINE# #INDENT# gs_body = li . get_words ( randint ( 3 , 7 ) ) #NEWLINE# new_gs = CompetencyArea . objects . create ( subject_area = new_sa , competency_area = gs_body ) #NEWLINE# for pi_num in range ( num_elements ) : #NEWLINE# #INDENT# pi_body = li . get_paragraph ( randint ( 2 , 5 ) ) #NEWLINE# new_pi = EssentialUnderstanding . objects . create ( essential_understanding = pi_body , competency_area = new_gs ) #NEWLINE# #UNINDENT# #UNINDENT# for sda_num in range ( num_elements ) : #NEWLINE# #INDENT# sda_name = li . get_words ( randint ( 2 , 3 ) ) #NEWLINE# new_sda = SubdisciplineArea . objects . create ( subject_area = new_sa , subdiscipline_area = sda_name ) #NEWLINE# for gs_num in range ( num_elements ) : #NEWLINE# #INDENT# gs_body = li . get_words ( randint ( 3 , 7 ) ) #NEWLINE# new_gs = CompetencyArea . objects . create ( subject_area = new_sa , subdiscipline_area = new_sda , competency_area = gs_body ) #NEWLINE# for pi_num in range ( num_elements ) : #NEWLINE# #INDENT# pi_body = li . get_paragraph ( randint ( 2 , 5 ) ) #NEWLINE# new_pi = EssentialUnderstanding . objects . create ( essential_understanding = pi_body , competency_area = new_gs )