def pay(request): if not request.session.has_key('weibo_id'): return weiboTools.signin() aid = int(request.GET['act_id']) member_id = int(request.GET['member_id']) member = WeiaaActivityMember.objects.filter(aid__aid = aid, uid__uid = member_id)[0] real_per_cost = '%.2f' % member.real_per_cost return render(request,'weiAA_app/pay.html',{'real_per_cost':real_per_cost})
def create_act_plan_form(request): if request.session.has_key('weibo_id'): weibo_id = request.session['weibo_id'] if WONIU_DEBUG: for key in request.POST: print 'POST:key=%s,value=%s' % (key,request.POST[key]) for key in request.GET: print 'GET:key=%s,value=%s' % (key,request.GET[key]) if WONIU_DEBUG: print 'get creating activity form from %s' % weibo_id if not (request.POST.has_key('act_id')): if WONIU_DEBUG: print 'not act_id' return redirect('/') if WONIU_DEBUG: print 'act_id=%s' % request.POST['act_id'] act = WeiaaActivity.objects.get(aid = int(request.POST['act_id'])) #create new activity plan: aid, creator_id, estimate_per_cost new_plan = WeiaaActivityPlan(aid = act, creator_id = WeiaaUser.objects.get(weibo_id = weibo_id)) #new_plan.save(); #plan item table begin #item_time #item_address #item_content #item_estimate_per_cost #plan item table end flag = True for i in range(1,50): key = 'item_time_%d' % i if request.POST.has_key(key): item_time = request.POST['item_time_%d' % i] if flag: new_plan.save(); flag = False item_address = request.POST['item_address_%d' % i] item_content = request.POST['item_content_%d' % i] item_estimate_per_cost = request.POST['item_estimate_per_cost_%d' % i] #set plan.esitmate_per_cost new_plan.estimate_per_cost += float(item_estimate_per_cost) new_plan.save(); #create plan item: start_time, place, content, estimate_per_cost item = WeiaaActivityPlanItem(apid = new_plan, start_time = item_time,place = item_address, content = item_content, estimate_per_cost = item_estimate_per_cost) item.save(); if WONIU_DEBUG: #plan item info print 'plan item info' print 'apiid:%s' % item.apiid print 'apid:%s' % item.apid print 'start_time:%s' % item.start_time print 'place:%s' % item.place print 'content:%s' % item.content print 'estimate_per_cost %s' % item.estimate_per_cost if WONIU_DEBUG: #activity plan info print 'activity plan info' print 'apid:%s' % new_plan.apid print 'aid:%s' % new_plan.aid print 'is_selected:%s' % new_plan.is_selected print 'vote:%s' % new_plan.vote print 'estimate_per_cost:%s' % new_plan.estimate_per_cost print 'real_cost:%s' % new_plan.real_cost print 'creator_id:%s' % new_plan.creator_id if WONIU_DEBUG: for key in request.POST: print 'key=%s,value=%s' % (key,request.POST[key]) return render(request,'weiAA_app/result.html',{'message_title':'您已成功为该活动创建了一个活动方案!'}) else: return weiboTools.signin()
def get_access_token(request): return weiboTools.signin()