Ejemplo n.º 1
0
def create_activity(club=None,
                    name='',
                    address='',
                    time_detail='',
                    description='',
                    total_quota=10,
                    participant_num=6,
                    detail=''):
    if not club:
        club = create_club()
    name = name or random_str(8)
    address = address or random_str(20)
    time_detail = time_detail or random_str(20)
    description = description or random_str(30)
    total_quota = total_quota or randint(10, 20)
    participant_num = participant_num or randint(5, 10)
    detail = detail or random_str(8)
    activity = CommercialActivity.objects.create(
        club=club,
        name=name,
        address=address,
        time_detail=time_detail,
        description=description,
        total_quota=total_quota,
        participant_num=participant_num,
        detail=detail,
        lon=club.lon,
        lat=club.lat)
    add_activity_location(activity.id, club.lon, club.lat)
    return activity
Ejemplo n.º 2
0
def create_club():
    return Club.objects.create(name=random_str(8),
                               fans_num=8,
                               address=random_str(20),
                               avatar=random_str(10),
                               lat=40 + 0.1 * randint(1, 8),
                               lon=116 + 0.1 * randint(1, 8))
Ejemplo n.º 3
0
def create_user_info(user):

    user_info = UserBaseInfo.objects.create(user=user,
                                            nickname=random_str(),
                                            signature=random_str(),
                                            sex=SexChoices.MALE,
                                            birthday=datetime.date(
                                                1989, 11, 25))
    return user_info
Ejemplo n.º 4
0
def create_footprint(user_info):
    image_list = []
    for i in range(random.randrange(5, 10)):
        image_list.append('https://image.zongzong.com/' + random_str(i))
    lon = 116 + 0.1 * random.randint(1, 8)
    lat = 40 + 0.1 * random.randint(1, 8)
    footprint = Footprint.objects.create(user=user_info.user,
                                         name=user_info.nickname,
                                         sex=user_info.sex,
                                         lat=lat,
                                         lon=lon,
                                         location=random_str(
                                             random.randint(1, 8)),
                                         content=random_str(20),
                                         image_list_str=json.dumps(image_list),
                                         forward_num=random.randint(1, 100),
                                         favor_num=random.randint(1, 100),
                                         comment_num=random.randint(1, 100))
    add_user_location(footprint.id, lon, lat)
    return footprint