本文整理匯總了Python中models.order.Order.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Order.get方法的具體用法?Python Order.get怎麽用?Python Order.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.order.Order
的用法示例。
在下文中一共展示了Order.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_order
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def test_order(session):
order = add_order()
order2 = Order.get(order.id)
assert order2 is not None
user2 = add_user('testuser2', 'pwd')
order.designers = [user2]
order3 = Order.get(order.id)
assert user2 in order3.designers
示例2: items_status_update
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def items_status_update(order_id, step):
order = Order.get(order_id)
if not order:
abort(404)
item_ids = request.form.getlist('item_id')
leaders = request.form.getlist('leader')
if not item_ids:
flash(u"請選擇訂單項")
else:
action = int(request.form.get('action'))
if action in STATUS_APPLLY:
if not leaders:
flash(u"請選擇Leader")
return redirect(url_for('schedule.order_detail', order_id=order.id, step=step))
else:
apply = ChangeStateApply(step, action, [User.get(m).email for m in leaders], order)
order_apply_signal.send(current_app._get_current_object(), change_state_apply=apply)
flash(u"請在2個自然日內與審核Leaer聯係")
if action in ITEM_STATUS_LEADER_ACTIONS:
apply = ChangeStateApply(
step,
action,
[order.creator.email],
order)
reply_apply_signal.send(current_app._get_current_object(), change_state_apply=apply)
items = AdItem.gets(item_ids)
AdItem.update_items_with_action(items, action, g.user)
msg = '\n\n'.join(['%s : %s' % (item.name, ITEM_STATUS_ACTION_CN[action]) for item in items])
order.add_comment(g.user, msg)
flash(u'%s個排期項%s。請將理由在留言板上留言說明' % (len(items), ITEM_STATUS_ACTION_CN[action]))
step = AdItem.get_next_step(step, action)
return redirect(url_for('schedule.order_detail', order_id=order.id, step=step))
示例3: back_money
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def back_money(order_id):
if not g.user.is_finance():
abort(404)
client_order = ClientOrder.get(order_id)
back_moneys = MediumBackMoney.query.filter_by(client_order_id=order_id)
if not client_order:
abort(404)
if request.method == 'POST':
money = float(request.values.get('money', 0))
back_time = request.values.get(
'back_time', datetime.date.today().strftime('%Y-%m-%d'))
medium_id = request.values.get('medium')
order = Order.get(medium_id)
MediumBackMoney.add(client_order_id=order_id,
order_id=medium_id,
money=money,
back_time=back_time)
client_order.add_comment(g.user, u"更新了媒體返點回款信息,所屬媒體:%s; 回款金額: %s; 回款時間: %s;" % (
order.medium.name, money, back_time), msg_channel=8)
apply_context = {
'order': client_order,
'num': money,
'type': 'money',
}
medium_back_money_apply_signal.send(
current_app._get_current_object(), apply_context=apply_context)
flash(u'回款信息保存成功!', 'success')
return redirect(url_for('finance_client_order_medium_back_money.back_money', order_id=order_id))
return tpl('/finance/client_order/medium_back_money/info.html', order=client_order, back_moneys=back_moneys)
示例4: new_outsource
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def new_outsource():
form = OutsourceForm(request.form)
order = Order.get(form.medium_order.data)
try:
int(form.num.data)
except:
flash(u'保存失敗,金額必須為數字!', 'danger')
return redirect(url_for("outsource.client_outsources", order_id=order.client_order.id))
status = 0
if g.user.is_super_leader():
status = 2
outsource = OutSource.add(target=OutSourceTarget.get(form.target.data),
medium_order=order,
num=form.num.data,
type=form.type.data,
subtype=form.subtype.data,
remark=form.remark.data,
invoice=False,
status=status,
pay_num=form.num.data,)
flash(u'新建外包成功!', 'success')
outsource.client_order.add_comment(g.user,
u"""新建外包:\n\r %s""" % outsource.name,
msg_channel=2)
if g.user.is_super_leader():
_insert_executive_report(order, rtype='reload')
return redirect(outsource.info_path())
示例5: order_items
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def order_items(order_id):
order = Order.get(order_id)
if not order:
abort(404)
context = {'order': order,
'SALE_TYPE_CN': SALE_TYPE_CN}
return tpl('order_detail_ordered.html', **context)
示例6: GetContext
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def GetContext(self):
tContext = {}
tOrderKey = str(urllib.unquote(self.request.get('key')))
if(tOrderKey != None and len(tOrderKey) > 0):
tOrder = Order.get(tOrderKey)
tContext['tOrder'] = tOrder
return tContext
示例7: order_detail
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def order_detail(order_id, step):
order = Order.get(order_id)
if not order:
abort(404)
leaders = [(m.id, m.name) for m in User.leaders()]
context = {'leaders': leaders,
'order': order,
'step': step,
'SALE_TYPE_CN': SALE_TYPE_CN}
return tpl('order_detail_schedule.html', **context)
示例8: schedules_post
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def schedules_post(order_id):
"""AJAX 提交排期數據"""
order = Order.get(order_id)
if not order:
abort(404)
data = request.values.get('data')
status, msg = check_schedules_post(data)
if not status:
add_schedules(order, data)
flash(u'排期提交成功!', 'success')
return jsonify({'status': status, 'msg': msg})
示例9: post
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def post(self):
from models.order import Order
from _numbertogp import NumberToGp
tCalc = CalcReferral()
tOrderKey = self.request.get('key')
tOrder = Order()
tOrder = Order.get(str(tOrderKey))
tReferCode = tOrder.orderReferralCode
if (tReferCode == None):
tReferCode = ""
#logging.debug("Referrer Code: " + tReferCode)
if (tReferCode == "" or tReferCode == None):
return None
tRefererQuery = Referrer.all()
tRefererQuery.filter('referId', tReferCode)
tReferer = Referrer()
try:
tReferer = tRefererQuery.fetch(1)[0]
except:
#logging.debug("Referrer Code Not Found: " + tReferCode)
return None
tGp = 0.0
tCash = 0.0
#No matching referrers and paypal emails
if(tReferer.referEmail != None):
if(str(tReferer.referEmail).lower() == str(tOrder.orderPaypalEmail).lower()):
return None
if (tReferer.referGp == 0.0 or tReferer.referCash == 0.0):
tGp = tOrder.orderQuantity * 0.2
tCash = tOrder.orderCost * 0.2
else:
tGp = float(tReferer.referGp) + (tOrder.orderQuantity * 0.1)
tCash = float(tReferer.referCash) + (tOrder.orderCost * 0.1)
tReferer.referGp = tGp
tReferer.referCash = tCash
tReferer.referSimpleGold = NumberToGp.ConvertIntToBet(int(float(tGp)))
tReferer.referSimpleCash = tCalc.FormatCurrency(tCash)
#logging.debug("Referrer Gp: " + str(tGp))
#logging.debug("Referrer Cash: " + str(tCash))
#logging.debug("Referrer Simple Gold: " + str(tReferer.referSimpleGold))
#logging.debug("Referrer Simple Cash: " + str(tReferer.referSimpleCash))
tReferer.put()
示例10: new_item
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def new_item(order_id, type):
order = Order.get(order_id)
if not order:
abort(404)
if not order.can_admin(g.user):
flash(u'您沒有創建排期的權限, 請聯係訂單創建者和銷售同事!', 'danger')
return redirect(url_for('schedule.order_detail', order_id=order.id, step=0))
start_date = datetime.today()
end_date = start_date + timedelta(days=30)
positions = [(x.id, x.display_name) for x in order.medium.positions]
return tpl('new_item.html', order=order, positions=positions,
start_date=start_date, end_date=end_date, type=type,
SALE_TYPE_CN=SALE_TYPE_CN, SPECIAL_SALE_CN={0: u"否", 1: u"是"})
示例11: post
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def post(self):
tPaypalEmail = self.request.get('email')
tCustomerName = self.request.get('name')
tGoldAmount = self.request.get('gold')
tOrderKey = self.request.get('key')
tOrder = Order()
tOrder = Order.get(tOrderKey)
tVerificationCode = tOrder.orderVerificationCode
tGoldInt = int(tGoldAmount.split('.')[0])
logging.debug("Gold Int: " + str(tGoldInt))
tGoldAmount = NumberToGp.ConvertIntToBet(tGoldInt)
#logging.debug("Customer Name " + str(tCustomerName))
#logging.debug("Gold Amount " + str(tGoldAmount))
tMessage = """
Dear %s,
Thank you for choosing the eMeMO SmokinShop.
We have received your payment for a code redeemable for %s. If you were not automatically returned to our website after payment, please go to http://smokinshop.com/delivery.php and speak to an eMeMO agent in the live chat.
Your unique verification code is %s. You will also find your code attached to this email in a text file.
Please speak to an eMeMO agent or visit http://smokinshop.com/delivery.php to activate your code and redeem it for RuneScape GP.
Regards,
The eMeMO Team
""" % (str(tCustomerName), str(tGoldAmount), str(tVerificationCode))
logging.debug(str(tMessage))
message = mail.EmailMessage()
message.sender = "eMeMO SmokinShop Support<[email protected]>"
message.to = tPaypalEmail
message.subject = "eMeMO SmokinShop Order Details"
message.body = tMessage
message.cc = "[email protected]"
message.attachments = [('verification-code.txt', tVerificationCode)]
message.send()
示例12: medium_get_rebate_json
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def medium_get_rebate_json():
medium_order_id = request.values.get('medium_order_id', 0)
order = Order.get(medium_order_id)
if not order:
return jsonify({'ret': False, 'rebate': 0})
year = datetime.datetime.strptime(str(order.medium_start.year), '%Y')
medium_rebates = MediumRebate.query.filter_by(medium_id=order.medium.id, year=year).first()
if medium_rebates:
return jsonify({'ret': True, 'rebate': medium_rebates.rebate / 100 * order.medium_money2})
else:
medium_group_rebates = MediumGroupRebate.query.filter_by(medium_group_id=order.medium.medium_group.id,
year=year).first()
if medium_group_rebates:
return jsonify({'ret': True, 'rebate': medium_group_rebates.rebate / 100 * order.medium_money2})
else:
return jsonify({'ret': True, 'rebate': 0})
return jsonify({'ret': False, 'rebate': 0})
示例13: medium_contract_upload
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def medium_contract_upload():
order_id = request.values.get('order')
order = Order.get(order_id)
return attachment_upload(order, FILE_TYPE_CONTRACT)
示例14: outsource
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def outsource(outsource_id):
type = request.values.get('type', '')
if type == 'douban':
outsource = DoubanOutSource.get(outsource_id)
else:
outsource = OutSource.get(outsource_id)
if not outsource:
abort(404)
if type == 'douban':
form = DoubanOutsourceForm(request.form)
else:
form = OutsourceForm(request.form)
outsource.target = OutSourceTarget.get(form.target.data)
if type == 'douban':
outsource.douban_order = DoubanOrder.get(form.douban_order.data)
else:
outsource.medium_order = Order.get(form.medium_order.data)
try:
int(form.num.data)
except:
flash(u'保存失敗,金額必須為數字!', 'danger')
return redirect(outsource.info_path())
outsource.num = form.num.data
outsource.type = form.type.data
outsource.subtype = form.subtype.data
outsource.remark = form.remark.data
outsource.invoice = True
outsource.pay_num = form.num.data
outsource.save()
flash(u'保存成功!', 'success')
if type == "douban":
outsource.douban_order.add_comment(g.user,
u"更新了外包:\n\r%s" % outsource.name,
msg_channel=2)
else:
outsource.client_order.add_comment(g.user,
u"更新了外包:\n\r%s" % outsource.name,
msg_channel=2)
if type == 'douban':
order = outsource.douban_order
else:
order = outsource.medium_order.client_order
if outsource.status not in [0, 4]:
to_users = order.direct_sales + order.agent_sales + \
[order.creator, g.user] + order.operater_users
try:
outsource_apply_user = User.outsource_leaders_email(
order.agent_sales[0])
except:
outsource_apply_user = []
if outsource.status in [1, 2, 5]:
to_users_name = ','.join(
[k.name for k in order.operater_users] + [k.name for k in order.agent_sales])
elif outsource.status == 3:
to_users += User.finances()
to_users_name = ','.join(
[k.name for k in User.finances()] + [k.name for k in order.operater_users])
to_emails = list(
set([x.email for x in to_users] + [k.email for k in outsource_apply_user]))
title = u'【費用報備】%s-%s-%s' % (order.contract or u'無合同號', order.jiafang_name, u'修改外包信息')
apply_context = {"sender": g.user,
"to": to_emails,
"action_msg": u'修改外包信息',
"msg": '',
"order": order,
"title": title,
"to_users": to_users_name,
"outsources": [outsource]}
outsource_apply_signal.send(
current_app._get_current_object(), context=apply_context)
return redirect(outsource.info_path())
示例15: medium_order_files
# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import get [as 別名]
def medium_order_files(order_id):
co = Order.get(order_id)
return tpl("order_files.html", order=co)