tag_quantity = (1, 2) UserManager.addPerson("ilyakh").set_password("123") UserManager.addPerson("kritisk").set_password("123") UserManager.addPerson("michael").set_password("123") UserManager.addPerson("peder").set_password("123") UserManager.addPerson("rantonse").set_password("123") UserManager.addPerson("rantonse1").set_password("123") UserManager.addPerson("rantonse2").set_password("123") UserManager.addPerson("rantonse3").set_password("123") persons = (StudentGenerator(5)).generate(number_of_persons) tags = (TagGenerator()).generate(number_of_tags) print "Creating wishes for {0} persons, with a set of {1} tags".format( len(persons), len(tags)) for p in persons: UserManager.addPerson(p) for p in Person.objects.all(): w = Wish(person=p) w.save() tq = tag_quantity chosen_tags = sample(tags, randint(tq[0], tq[1])) for t in chosen_tags: w.tags.add(TagManager.addTag(t))
def __getitem__(self, tag_name): if tag_name.__class__ == str: tag_name = TagManager.getTag(tag_name) return self.tag_dict[tag_name]
UserManager.addPerson( "peder" ).set_password( "123" ) UserManager.addPerson( "rantonse" ).set_password( "123" ) UserManager.addPerson( "rantonse1" ).set_password( "123" ) UserManager.addPerson( "rantonse2" ).set_password( "123" ) UserManager.addPerson( "rantonse3" ).set_password( "123" ) persons = ( StudentGenerator( 5 ) ).generate( number_of_persons ) tags = ( TagGenerator() ).generate( number_of_tags ) print "Creating wishes for {0} persons, with a set of {1} tags".format( len(persons), len(tags) ) for p in persons: UserManager.addPerson( p ) for p in Person.objects.all(): w = Wish( person=p ) w.save() tq = tag_quantity chosen_tags = sample( tags, randint( tq[0], tq[1] ) ) for t in chosen_tags: w.tags.add( TagManager.addTag( t ) )