Пример #1
0
def set_bg(request):
    post = request.POST
    logging.debug('got post: %s' % post)
    xn = request.xiaonei
    user = get_or_create_xnuser(xn)
    selected_bg = post.get('selected[]')
    user.bg_style = int(selected_bg)
    if not user.app_users:
        user.app_users = []
    user.put()
    logging.debug('set bg_style: %s' % selected_bg)
    refresh_user_cache(user)
    return xn.redirect(reverse_xn('canvas', xn.get_app_url()))
Пример #2
0
def post_invite(request):
    post = request.POST
    logging.debug('got post: %s' % post)
    xn = request.xiaonei
    user = get_or_create_xnuser(xn)
    invited = post.getlist('ids[]')
    if not user.num_invited:
        user.num_invited = len(invited)
    else:
        user.num_invited += len(invited)
    user.put()
    refresh_user_cache(user)
    url = reverse_xn('choose_bg', xn.get_app_url())
    return xn.redirect(url)