<s> import sys , os <EOL> sys . path . append ( os . path . realpath ( os . sep . join ( [ os . path . dirname ( __file__ ) , os . pardir ] ) ) ) <EOL> from django . core . management import setup_environ <EOL> import settings <EOL> setup_environ ( settings ) <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from discovery . models import TopCategory , SubCategory , DiscoveryItem <EOL> from org . models import Org <EOL> ISSUE_TYPE = ContentType . objects . get ( app_label = '<STR_LIT>' , model = '<STR_LIT>' ) <EOL> ORG_TYPE = ContentType . objects . get ( app_label = '<STR_LIT>' , model = '<STR_LIT>' ) <EOL> ORGS = Org . objects . all ( ) [ : <NUM_LIT:30> ] <EOL> CATEGORIES = [ <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ] ) , <EOL> ] <EOL> def load_discovery_data ( ) : <EOL> for tc_rank , ( tc_name , sub_categories ) in enumerate ( CATEGORIES ) : <EOL> tc = TopCategory ( name = tc_name , rank = tc_rank ) <EOL> tc . save ( ) <EOL> for sc_rank , sc_name in enumerate ( sub_categories ) : <EOL> sc = SubCategory ( name = sc_name , parent = tc , rank = sc_rank ) <EOL> sc . save ( ) <EOL> for di_rank in range ( <NUM_LIT:4> ) : <EOL> di = DiscoveryItem ( entity = ORGS [ <NUM_LIT:4> * sc_rank + di_rank ] , parent = sc , rank = di_rank ) <EOL> di . save ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> load_discovery_data ( ) </s>
