(request, acc_type)
Request for upgrade account to acc_type. Redirect to alipay
  payment web page due to ACC_TYPE.
Request for upgrade account to acc_type. Redirect to alipay
  payment web page due to ACC_TYPE.
Request for upgrade account to acc_type . Redirect to alipay payment web page due to ACC_TYPE .
def upgrade_account (request, acc_type):
  """
  Request for upgrade account to acc_type. Redirect to alipay
  payment web page due to ACC_TYPE.
  """
  user = request.user
  bill = None
  try: bill = user.bill
  except: bill = Bill (user=user)
  bill.upgrade_type = acc_type
  bill.save()
  tn = bill.pk
  if acc_type == "bronze":
    url=create_partner_trade_by_buyer (tn, u'ikindle杂志订阅(4份)',
                                       u'订阅杂志到你的Kindle， 2.99x6个月', '0.01')
    return HttpResponseRedirect (url)
  elif acc_type == "silver":
    url=create_partner_trade_by_buyer (tn, u'ikindle杂志订阅(6份)',
                                       u'订阅杂志到你的Kindle，3.99x6个月', '0.01')
    return HttpResponseRedirect (url)
  elif acc_type == "gold":
    url=create_partner_trade_by_buyer (tn, u'ikindle杂志订阅(无限制)',
                                       u'订阅杂志到你的Kindle，5.99x6个月', '0.01')
    return HttpResponseRedirect (url)
  else:
    return HttpResponseRedirect (reverse ('payment_error'))
def upgrade_account ( request , acc_type ) : user = request . user bill = None try : bill = user . bill except : bill = Bill ( user = user ) bill . upgrade_type = acc_type bill . save ( ) tn = bill . pk if acc_type == "bronze" : url = create_partner_trade_by_buyer ( tn , u'ikindle杂志订阅(4份)', u'订阅杂志到你的Kindle， 2.99x6个月', '0.01') return HttpResponseRedirect ( url ) elif acc_type == "silver" : url = create_partner_trade_by_buyer ( tn , u'ikindle杂志订阅(6份)', u'订阅杂志到你的Kindle，3.99x6个月', '0.01') return HttpResponseRedirect ( url ) elif acc_type == "gold" : url = create_partner_trade_by_buyer ( tn , u'ikindle杂志订阅(无限制)', u'订阅杂志到你的Kindle，5.99x6个月', '0.01') return HttpResponseRedirect ( url ) else : return HttpResponseRedirect ( reverse ( 'payment_error' ) )