Пример #1
0
def gen_orders(user_lis, item_lis, total_orders=50):
    for _ in range(total_orders):
        random_item = choice(item_lis)
        random_user = choice(user_lis)
        dic = {
            "user_id": random_user.obj_id(),
            "obj_id": random_item.obj_id(),
            "coll_name": "item",
            "quantity": choice(range(1, 2)),
            "special_notes": loremipsum.sentence(),
            "status": OrderStatus.OK,
        }
        order_obj = Order.unserialize(dic)
        save(order_obj)
Пример #2
0
def rsvp_campaign(campaign_id):
    #get form values
    form_values = get_form_values(request, __rsvp_email_form())

    #create attendee user with only email address
    user_obj = users.User()
    user_obj.email = form_values["rsvp_email"]
    users.save(user_obj)

    #save order
    order_id = orders.save(user_obj, campaigns.Campaign.coll_name(), campaign_id)
    return "Saved order with id: %s" % (order_id)