Пример #1
0
                names_part1.append(row[0])
            if row[1]:
                names_part2.append(row[1])

    for i in range(1, args.number_gyms):
        found = False
        while not found:
            part1 = random.choice(names_part1)
            part2 = random.choice(names_part2)

            # We don't want names like "Iron Iron"
            if part1 != part2:
                found = True

        name = "{0} {1}".format(part1, part2)
        gym = Gym()
        gym.name = name
        gym_list.append(gym)

        print('   - {0}'.format(gym.name))

    # Bulk-create all the gyms
    Gym.objects.bulk_create(gym_list)

#
# Workout generator
#
if hasattr(args, 'number_workouts'):
    print("** Generating {0} workouts per user".format(args.number_workouts))

    if args.add_to_user:
Пример #2
0
                names_part1.append(row[0])
            if row[1]:
                names_part2.append(row[1])

    for i in range(1, args.number_gyms):
        found = False
        while not found:
            part1 = random.choice(names_part1)
            part2 = random.choice(names_part2)

            # We don't want names like "Iron Iron"
            if part1 != part2:
                found = True

        name = "{0} {1}".format(part1, part2)
        gym = Gym()
        gym.name = name
        gym_list.append(gym)

        print('   - {0}'.format(gym.name))

    # Bulk-create all the gyms
    Gym.objects.bulk_create(gym_list)


#
# Workout generator
#
if hasattr(args, 'number_workouts'):
    print("** Generating {0} workouts per user".format(args.number_workouts))