<s> from app . models import ContactGroup , Gender , Contact <EOL> import random <EOL> from datetime import datetime <EOL> def get_random_name ( names_list , size = <NUM_LIT:1> ) : <EOL> name_lst = [ names_list [ random . randrange ( <NUM_LIT:0> , len ( names_list ) ) ] . capitalize ( ) for i in range ( <NUM_LIT:0> , size ) ] <EOL> return "<STR_LIT:U+0020>" . join ( name_lst ) <EOL> ContactGroup . drop_collection ( ) <EOL> Gender . drop_collection ( ) <EOL> Contact . drop_collection ( ) <EOL> g1 = ContactGroup ( name = '<STR_LIT>' ) . save ( ) <EOL> g2 = ContactGroup ( name = '<STR_LIT>' ) . save ( ) <EOL> g3 = ContactGroup ( name = '<STR_LIT>' ) . save ( ) <EOL> groups = [ g1 , g2 , g3 ] <EOL> gender1 = Gender ( name = '<STR_LIT>' ) . save ( ) <EOL> gender2 = Gender ( name = '<STR_LIT>' ) . save ( ) <EOL> genders = [ gender1 , gender2 ] <EOL> f = open ( '<STR_LIT>' , "<STR_LIT:rb>" ) <EOL> names_list = [ x . strip ( ) for x in f . readlines ( ) ] <EOL> f . close ( ) <EOL> for i in range ( <NUM_LIT:1> , <NUM_LIT:1000> ) : <EOL> c = Contact ( ) <EOL> c . name = get_random_name ( names_list , random . randrange ( <NUM_LIT:2> , <NUM_LIT:6> ) ) <EOL> c . address = '<STR_LIT>' + names_list [ random . randrange ( <NUM_LIT:0> , len ( names_list ) ) ] <EOL> c . personal_phone = str ( random . randrange ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> c . personal_celphone = str ( random . randrange ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> c . contact_group = groups [ random . randrange ( <NUM_LIT:0> , <NUM_LIT:3> ) ] <EOL> c . gender = genders [ random . randrange ( <NUM_LIT:0> , <NUM_LIT:2> ) ] <EOL> year = random . choice ( range ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> month = random . choice ( range ( <NUM_LIT:1> , <NUM_LIT:12> ) ) <EOL> day = random . choice ( range ( <NUM_LIT:1> , <NUM_LIT> ) ) <EOL> c . birthday = datetime ( year , month , day ) <EOL> c . save ( ) <EOL> print c </s>
