本文整理汇总了Python中sys2do.model.DBSession类的典型用法代码示例。如果您正苦于以下问题:Python DBSession类的具体用法?Python DBSession怎么用?Python DBSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: import_supplier
def import_supplier(payment1):
print "insert supplier"
DBSession.add_all([
Supplier(name = u'中深翔', display_name = u'中深翔', address = u'布吉丹竹头金鹏物流园A区A栋18-20号', mobile = '13600432849', contact_person = u'全总', remark = u'上海', payment = payment1),
Supplier(name = u'深中联', display_name = u'深中联', address = u'布吉丹竹头金鹏物流园A栋5-6号', mobile = '13392826777,18902480211', contact_person = u'王总,丁小姐', remark = u'温州、台州、温岭、临海、黄岩', payment = payment1),
Supplier(name = u'旺平达', display_name = u'旺平达', address = u'龙华明治大道华通源物流中心B2栋263-266号', mobile = '15099917300', contact_person = u'李飞章', remark = u'苏州、无锡、昆山、张家港、宜兴、常熟、太仓、吴江', payment = payment1),
Supplier(name = u'顺福', display_name = u'顺福', address = u'丹竹头白泥坑宇达物流园3栋301-318号', phone = '89575677', mobile = '13316895558', contact_person = u'陈老板', remark = u'徐州、南通、淮安、盐城、连云港、启东', payment = payment1),
Supplier(name = u'鑫金叶', display_name = u'鑫金叶', address = u'布吉李朗东西干道南岭大龙山物流园G栋1-3号', mobile = '13906667228', contact_person = u'金经理 ', remark = u'温州苍南', payment = payment1),
Supplier(name = u'华发', display_name = u'华发', address = u'金鹏物流园B区9栋7-12号', mobile = '15999677737', contact_person = u' 陈老板', remark = u'南京、常州、扬州、泰州、镇江、靖江', payment = payment1),
Supplier(name = u'京鹏', display_name = u'京鹏', address = u'华通源物流中心C4栋138-152号', mobile = '13066815788,13066815788', contact_person = u'老板娘 傅总', remark = u'杭州、上虞、湖州、德清、临安、丽水、桐乡、长兴、云南省', payment = payment1),
Supplier(name = u'凯林瑞', display_name = u'凯林瑞', address = u'龙岗区丹竹头金鹏物流园B区D栋41-42号', phone = '0755-82432843', mobile = '', contact_person = u'杨总', remark = u'浙江嘉兴', payment = payment1),
Supplier(name = u'海联', display_name = u'海联', address = u'华通源物流中心', mobile = '18688838882', contact_person = u'李老板', remark = u'宁波、义乌、绍兴、衢州、诸暨、金华、慈溪、余姚、舟山、奉化', payment = payment1),
Supplier(name = u'荣晖', display_name = u'荣晖', address = u'金鹏A区B栋15-18号,40-42号', mobile = '13631528080', contact_person = u'胡总', remark = u'南昌、赣州、新余、吉安、九江、萍乡、宜春、鹰潭', payment = payment1),
Supplier(name = u'深湘', display_name = u'深湘', address = u'长城货代市场83档', mobile = '13902485137', contact_person = u'丘总', remark = u'长沙、常德、衡阳、株洲、湘阴、岳阳、怀化、湘潭', payment = payment1),
Supplier(name = u'澳跃', display_name = u'澳跃', address = u'金鹏', mobile = '13902311565', contact_person = u'肖总', remark = u'武汉、黄冈、黄石、荆州、咸宁、孝感、襄樊、恩施、十堰、襄阳', payment = payment1),
Supplier(name = u'金鹏行', display_name = u'金鹏行', address = u'', mobile = '18926534999', contact_person = u'俞总', remark = u'合肥、淮南、黄山、桐城、芜湖、宣城、安庆、铜陵、涡阳、滁州、怀远', payment = payment1),
Supplier(name = u'京鹏', display_name = u'京鹏', address = u'华通源物流中心C4栋138-152号', mobile = '13066815788', contact_person = u'傅小姐', remark = u'昆明、大理、曲靖、景洪', payment = payment1),
Supplier(name = u'鑫辉', display_name = u'鑫辉', address = u'布吉丹平路闽鹏程货运市场11栋1-4号', mobile = '13925234059', contact_person = u'刘先生', remark = u'龙岩、三明', payment = payment1),
Supplier(name = u'广运物流', display_name = u'广运物流', address = u'龙岗丹竹头闽鹏程货运市场5栋29-30号', mobile = '18923724600', contact_person = u'徐先生', remark = u'顺德', payment = payment1),
Supplier(name = u'金华航', display_name = u'金华航', address = u'华通源物流园', phone = '0755-23022756', mobile = '', contact_person = u'刘先生', remark = u'中山', payment = payment1),
Supplier(name = u'速速达', display_name = u'速速达', address = u'龙岗区布吉上李朗方鑫路22号速速达物流', phone = None, mobile = '13392831936', contact_person = u'王晓刚', remark = u'南宁、桂林、柳州、钦州', payment = payment1),
Supplier(name = u'盛丰', display_name = u'盛丰', address = u'龙岗区南湾街道吉厦社区早禾坑工业区15号A栋', phone = None, mobile = '13798363667', contact_person = u'周总', remark = u'泉州、福州、莆田、福清', payment = payment1),
Supplier(name = u'美泰', display_name = u'美泰', address = u'龙岗布吉大龙山物流园F栋10号美泰物流', phone = None, mobile = '18926795962', contact_person = u'毛主管', remark = u'广州', payment = payment1),
Supplier(name = u'凯利', display_name = u'凯利', address = u'布吉单竹头金鹏物流园B区E栋1-5号 ', phone = '61217611,61217600', mobile = '', contact_person = u'熊小姐', remark = u'三亚、海口、琼海、万宁', payment = payment1),
Supplier(name = u'骏兴顺', display_name = u'骏兴顺', address = u'龙华民治大道华通源物流中心C1栋58-60号', phone = None, mobile = '15914055308', contact_person = u'曾经理', remark = u'贵阳、金沙、安顺', payment = payment1),
Supplier(name = u'澳跃', display_name = u'澳跃', address = u'金鹏A区栋13-15号', phone = None, mobile = '18923411132', contact_person = u'李峰', remark = u'漳州', payment = payment1),
Supplier(name = u'勤威', display_name = u'勤威', address = u'金鹏B区C栋33号', phone = None, mobile = '13728866595', contact_person = u'石总', remark = u'厦门', payment = payment1),
])
DBSession.commit()
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:29,代码来源:init.py
示例2: review
def review(self):
id = _g('id') or None
if not id :
flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
return redirect(self.default())
try:
header = DBSession.query(OrderHeader).get(id)
logs = []
logs.extend(header.get_logs())
try:
deliver_detail = DBSession.query(DeliverDetail).filter(and_(DeliverDetail.active == 0, DeliverDetail.order_header_id == header.id)).one()
deliver_heaer = deliver_detail.header
# for f in deliver_heaer.get_logs() : _info(f.remark)
logs.extend(deliver_heaer.get_logs())
except:
pass
logs = sorted(logs, cmp = lambda x, y: cmp(x.transfer_date, y.transfer_date))
return {
'header' : header ,
'transit_logs' : logs,
}
except:
_error(traceback.print_exc())
flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
return redirect(self.default())
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:28,代码来源:order.py
示例3: save_update
def save_update(self):
id = _g('id', None)
if not id :
flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
return redirect(url_for('.view'))
obj = DBSession.query(Customer).get(id)
if not obj :
flash(MSG_RECORD_NOT_EXIST, MESSAGE_ERROR)
return redirect(url_for('.view'))
try:
fields = ['no', 'name', 'display_name', 'province_id', 'city_id',
'address', 'contact_person', 'mobile', 'phone', 'email', 'note_id', 'remark']
old_info = obj.serialize(fields) # to used for the history log
for f in fields:
setattr(obj, f, _g(f))
#handle the file upload
old_attachment_ids = map(lambda (k, v) : v, _gp("old_attachment_"))
old_attachment_ids.extend(multiupload())
obj.attachment = old_attachment_ids
DBSession.commit()
flash(MSG_SAVE_SUCC, MESSAGE_INFO)
# return redirect(url_for('.view',id=obj.id))
new_info = obj.serialize(fields)
change_result = obj.compare(old_info, new_info)
obj.insert_system_logs(change_result)
except:
_error(traceback.print_exc())
DBSession.rollback()
flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
return redirect(url_for('.view', action = "view", id = obj.id))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:32,代码来源:customer.py
示例4: _compute_ratio
def _compute_ratio(self, customer_id, province_id, city_id):
qty_ratio = ''
weight_ratio = ''
vol_ratio = ''
q1 = DBSession.query(CustomerDiquRatio).filter(and_(CustomerDiquRatio.active == 0,
CustomerDiquRatio.customer_id == customer_id,
CustomerDiquRatio.province_id == province_id,
CustomerDiquRatio.city_id == city_id,
))
if q1.count() == 1:
t = q1.one()
qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
else:
q2 = DBSession.query(CustomerDiquRatio).filter(and_(CustomerDiquRatio.active == 0,
CustomerDiquRatio.customer_id == customer_id,
CustomerDiquRatio.province_id == province_id,
CustomerDiquRatio.city_id == None,
))
if q2.count() == 1:
t = q2.one()
qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
else:
q3 = DBSession.query(City).filter(and_(City.active == 0, City.id == city_id))
if q3.count() == 1:
t = q3.one()
qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
else:
q4 = DBSession.query(Province).filter(and_(Province.active == 0, Province.id == province_id))
if q4.count() == 1:
t = q4.one()
qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
# try:
# t = DBSession.query(CustomerDiquRatio).filter(and_(CustomerDiquRatio.active == 0,
# CustomerDiquRatio.customer_id == customer_id,
# CustomerDiquRatio.province_id == province_id,
# CustomerDiquRatio.city_id == city_id,
# )).one()
# qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
# except:
# try:
# t = DBSession.query(CustomerDiquRatio).filter(and_(CustomerDiquRatio.active == 0,
# CustomerDiquRatio.customer_id == customer_id,
# CustomerDiquRatio.province_id == province_id,
# CustomerDiquRatio.city_id == None,
# )).one()
# qty_ratio, weight_ratio, vol_ratio = t.qty_ratio, t.weight_ratio, t.vol_ratio
# except:
# try:
# c = DBSession.query(City).filter(and_(City.active == 0, City.id == city_id)).one()
# qty_ratio, weight_ratio, vol_ratio = c.qty_ratio, c.weight_ratio, c.vol_ratio
# except:
# try:
# p = DBSession.query(Province).filter(and_(Province.active == 0, Province.id == province_id)).one()
# qty_ratio, weight_ratio, vol_ratio = p.qty_ratio, p.weight_ratio, p.vol_ratio
# except: pass
return {'qty_ratio' : qty_ratio, 'weight_ratio' : weight_ratio, 'vol_ratio' : vol_ratio}
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:60,代码来源:root.py
示例5: saveAsNew
def saveAsNew(clz, v):
params = {}
for f in ['name', 'password', 'email', 'image_url', 'phone', 'mobile', ]:
params[f] = v.get(f, None) or None
one = clz(**params)
DBSession.add(one)
return one
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:7,代码来源:auth.py
示例6: saveProfile
def saveProfile(self):
uid = session['user_profile']['id']
user = DBSession.query(User).get(uid)
user.mobile = _g('mobile')
DBSession.commit()
flash(MSG_SAVE_SUCC, MESSAGE_INFO)
return redirect(url_for('.view'))
开发者ID:LamCiuLoeng,项目名称:appwebsite,代码行数:7,代码来源:consoles.py
示例7: init
def init():
try:
print "create tables"
metadata.drop_all(engine, checkfirst = True)
metadata.create_all(engine)
print "insert default value"
DBSession.add(User(name = 'demo', password = 'demo'))
for code in range(9121, 9140):
DBSession.add(NFCData(authcode = unicode(code), company = 'RoyalDragonVodka',
serial = code - 9000,
))
f = open('country.txt', 'r')
cs = f.readlines()
f.close()
for c in cs:
n, c, iso = c.split('|')
DBSession.add(MLocation(name = n, iso_code = iso, code = c))
DBSession.commit()
print "finish init!"
except:
traceback.print_exc()
DBSession.rollback()
开发者ID:LamCiuLoeng,项目名称:nfcdemo,代码行数:25,代码来源:init.py
示例8: getDoctorDetail
def getDoctorDetail():
fields = ["lang", "doctorID", "clinicID"]
if _check_params(fields) != 0:
return jsonify({"result": 0, "msg": MSG_PARAMS_MISSING})
lang = _g("lang")
dp = DBSession.query(DoctorProfile).get(_g("doctorID"))
base_info = dp.getUserProfile()
c = DBSession.query(Clinic).get(_g("clinicID"))
latitude = longtitude = None
if c.coordinate:
latitude, longtitude = c.coordinate.split(",")
return jsonify(
{
"result": 1,
"data": {
"doctorID": dp.id,
"name": {"zh_HK": base_info["display_name_tc"], "zh_CN": base_info["display_name_sc"]}.get(
lang, base_info["display_name"]
),
"desc": dp.desc,
"tel": c.tel,
"address": {"zh_HK": c.address_tc, "zh_CN": c.address_sc}.get(lang, c.address),
"image": base_info["image_url"],
"mapLocationX": longtitude,
"mapLocationY": latitude,
"rating": dp.rating,
},
}
)
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:32,代码来源:api.py
示例9: barcode
def barcode(self):
method = _g('m', 'LIST')
if method not in ['LIST', 'NEW', 'PRINT', 'SAVE_NEW']:
flash(MSG_NO_SUCH_ACTION, MESSAGE_ERROR);
return redirect(url_for('.view', action = 'index'))
DBObj = Barcode
index_page = 'admin/barcode_index.html'
new_page = 'admin/barcode_new.html'
print_page = 'admin/barcode_print.html'
action = 'barcode'
if method == 'LIST':
if _g('SEARCH_SUBMIT'): # come from search
values = {'page' : 1}
for f in ['value', 'ref_no', 'status', 'create_time_from', 'create_time_to'] :
values[f] = _g(f)
values['field'] = _g('field', None) or 'create_time'
values['direction'] = _g('direction', None) or 'desc'
else: #come from paginate or return
values = session.get('master_barcode_values', {})
if _g('page') : values['page'] = int(_g('page'))
elif 'page' not in values : values['page'] = 1
session['master_barcode_values'] = values
conditions = [DBObj.active == 0]
if values.get('value', None): conditions.append(DBObj.value.op('like')('%%%s%%' % values['value']))
if values.get('ref_no', None): conditions.append(DBObj.ref_no.op('like')('%%%s%%' % values['ref_no']))
if values.get('status', None): conditions.append(DBObj.status == values['status'])
if values.get('create_time_from', None): conditions.append(DBObj.create_time > values['create_time_from'])
if values.get('create_time_to', None): conditions.append(DBObj.create_time < '%s 23:59' % values['create_time_to'])
field = values.get('field', 'create_time')
if values.get('direction', 'desc') == 'desc':
result = DBSession.query(DBObj).filter(and_(*conditions)).order_by(desc(getattr(DBObj, field)))
else:
result = DBSession.query(DBObj).filter(and_(*conditions)).order_by(getattr(DBObj, field))
def url_for_page(**params): return url_for('bpAdmin.view', action = action, m = 'LIST', page = params['page'])
records = paginate.Page(result, values['page'], show_if_single_page = True, items_per_page = 100, url = url_for_page)
return render_template(index_page, records = records, action = action, values = values)
elif method == 'NEW':
return render_template(new_page, action = action)
elif method == 'PRINT':
ids = _gl('ids')
records = DBSession.query(DBObj).filter(DBObj.id.in_(ids)).order_by(desc(DBObj.create_time))
return render_template(print_page, records = records)
elif method == 'SAVE_NEW':
qty = _g('qty')
records = [DBObj.getOrCreate(None, None, status = 1) for i in range(int(qty))]
DBSession.commit()
if _g('type') == 'CREATE':
flash(MSG_SAVE_SUCC, MESSAGE_INFO)
return redirect(url_for('.view', action = action))
else:
return render_template(print_page, records = records)
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:58,代码来源:admin.py
示例10: saveAsNew
def saveAsNew(clz, v):
params = {}
for f in ['name', 'code', 'province_id', 'city_id', 'begin_no', 'end_no',
'apply_time', 'apply_person_id', 'operator_id', 'remark']:
params[f] = v.get(f, None) or None
obj = clz(**params)
DBSession.add(obj)
return obj
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:9,代码来源:master.py
示例11: profit
def profit(self):
if _g('SEARCH_SUBMIT'): # come from search
values = {'page' : 1}
for f in [
'no', 'create_time_from', 'create_time_to', 'destination_province_id', 'destination_city_id',
'ref_no', 'deliver_no', 'supplier_id', 'payment_id', 'is_discount_return'
] :
values[f] = _g(f)
values['field'] = _g('field', None) or 'create_time'
values['direction'] = _g('direction', None) or 'desc'
else: # come from paginate or return
values = session.get('fin_profit_values', {})
if _g('page') : values['page'] = int(_g('page'))
elif 'page' not in values : values['page'] = 1
if not values.get('create_time_from', None) and not values.get('create_time_to', None):
values['create_time_to'] = dt.now().strftime("%Y-%m-%d")
values['create_time_from'] = (dt.now() - timedelta(days = 30)).strftime("%Y-%m-%d")
session['fin_profit_values'] = values
conditions = [OrderHeader.active == 0,
DeliverHeader.active == 0 , DeliverDetail.active == 0, DeliverHeader.id == DeliverDetail.header_id,
OrderHeader.id == DeliverDetail.order_header_id,
]
if values.get('create_time_from', None): conditions.append(OrderHeader.order_time > values['create_time_from'])
if values.get('create_time_to', None): conditions.append(OrderHeader.order_time < '%s 23:59' % values['create_time_to'])
if values.get('ref_no', None): conditions.append(OrderHeader.ref_no.op('like')('%%%s%%' % values['ref_no']))
if values.get('deliver_no', None): conditions.append(DeliverHeader.no.op('like')('%%%s%%' % values['deliver_no']))
if values.get('destination_province_id', None):
conditions.append(OrderHeader.destination_province_id == values['destination_province_id'])
dp = DBSession.query(Province).get(values['destination_province_id'])
destination_cites = dp.children()
else: destination_cites = []
if values.get('destination_city_id', None): conditions.append(OrderHeader.destination_city_id == values['destination_city_id'])
if values.get('supplier_id', None): conditions.append(DeliverHeader.supplier_id == values['supplier_id'])
if values.get('payment_id', None): conditions.append(OrderHeader.payment_id == values['payment_id'])
if values.get('is_discount_return', None): conditions.append(OrderHeader.is_discount_return == values['is_discount_return'])
# for the sort function
field = values.get('field', 'create_time')
if values.get('direction', 'desc') == 'desc':
result = DBSession.query(OrderHeader, DeliverHeader).filter(and_(*conditions))
else:
result = DBSession.query(OrderHeader, DeliverHeader).filter(and_(*conditions))
def url_for_page(**params): return url_for('bpFin.view', action = "profit", page = params['page'])
records = paginate.Page(result, values['page'], show_if_single_page = True, items_per_page = PAGINATE_PER_PAGE, url = url_for_page)
return {
'values' : values ,
'records' : records,
'destination_cites' : destination_cites,
}
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:56,代码来源:fin.py
示例12: _save_new
def _save_new(self):
try:
result = self.dbObj.save_new(self)
DBSession.commit()
self.flash("Save the record successfully!")
except Exception as e:
DBSession.rollback()
self.flash(getattr(e, "msg", None) or "This operation is not available now!")
self._new()
self.redirect("%s?action=view&id=%d" % (self.url_prefix, result.id))
开发者ID:LamCiuLoeng,项目名称:BookStore,代码行数:10,代码来源:base.py
示例13: save_new
def save_new(clz, handler):
params = {
"user_name" : handler.get_argument("user_name", None),
"email_address" : handler.get_argument("email_address", None),
"display_name" : handler.get_argument("display_name", None),
"password" : handler.get_argument("password", None),
}
record = clz(**params)
DBSession.add(record)
return record
开发者ID:LamCiuLoeng,项目名称:BookStore,代码行数:10,代码来源:auth.py
示例14: save_events
def save_events():
uid = request.values.get("uid", None)
did = request.values.get("did", None)
d = request.values.get("d", None)
t = request.values.get("t", None)
if not uid or not did or not d or not t:
return jsonify({"success": False, "message": "The required info is not supplied !"})
format_date = lambda v: "-".join([v[:4], v[4:6], v[-2:]])
try:
e = Events(user_id=uid, doctor_id=did, date=d, time=t, remark=request.values.get("remark", None))
DBSession.add(e)
doctor = DBSession.query(DoctorProfile).get(did).getUserProfile()
m = Message(
subject=u"Booking request submit",
user_id=session["user_profile"]["id"],
content=u"%s make a booking with doctor %s at %s , %s."
% (session["user_profile"]["name"], doctor["name"], t, format_date(d)),
)
DBSession.add(m)
DBSession.commit()
return jsonify({"success": True, "message": "Save your request successfully !", "event_time": e.time})
except:
DBSession.rollback()
app.logger.error(traceback.format_exc())
return jsonify({"success": False, "message": "Error occur when submiting the request !"})
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:27,代码来源:action.py
示例15: save_new
def save_new(self):
params = {
"name" : _g('name'),
"address" : _g('address'),
"manager" : _g('manager'),
"remark" : _g('remark'),
"parent_id" : _g('parent_id'),
}
try:
obj = InventoryLocation(**params)
DBSession.add(obj)
DBSession.flush()
if params['parent_id']:
parent = DBSession.query(InventoryLocation).get(obj.parent_id)
obj.full_path = "%s%s" % (parent.full_path or '', params['name'])
obj.full_path_ids = "%s|%s" % (parent.full_path_ids, obj.id)
else:
obj.full_path = params['name']
obj.full_path_ids = obj.id
DBSession.commit()
flash(MSG_SAVE_SUCC, MESSAGE_INFO)
except:
DBSession.rollback()
_error(traceback.print_exc())
return redirect(self.default())
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:28,代码来源:warehouse.py
示例16: m_events_update
def m_events_update():
id = _g("id")
if not id :
flash("No id supplied !", MESSAGE_ERROR)
return redirect(url_for("m_events_list"))
action_type = _g("action_type")
if not action_type in ["m", "c", "p"]:
flash("No such action !", MESSAGE_ERROR)
return redirect(url_for("m_events_list"))
e = DBSession.query(Events).get(id)
# e = connection.Events.one({"id" : int(id)})
if action_type == "m":
return render_template("m_events_update.html", event = e)
elif action_type == "c": #cancel
e.status = 2
DBSession.add(Message(subject = u"Cancel Booking Event", user_id = e.user_id,
content = u"%s cancel the booking request." % session['user_profile']['name']))
DBSession.commit()
return jsonify({"success" : True, "message" : "Update successfully !"})
elif action_type == "p": #confirmed
e.status = 1
DBSession.add(Message(subject = u"Confirm Booking Event", user_id = e.user_id,
content = u"%s confirm the booking request." % session['user_profile']['name']))
DBSession.commit()
return jsonify({"success" : True, "message" : "Update successfully !"})
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:27,代码来源:manage.py
示例17: _save_update
def _save_update(self):
try:
result = self.dbObj.save_update(self.get_argument("id", None), self)
DBSession.commit()
self.flash("Save the record successfully!")
except Exception as e:
logging.error(traceback.print_exc())
DBSession.rollbak()
self.flash(getattr(e, "msg", None) or "This operation is not available now!")
self._update()
self.redirect("%s?action=view&id=%d" % (self.url_prefix, result.id))
开发者ID:LamCiuLoeng,项目名称:BookStore,代码行数:11,代码来源:base.py
示例18: delete
def delete(self):
header = getOr404(OrderHeader, _g('id'), redirect_url = self.default())
header.active = 1
DBSession.add(SystemLog(
type = header.__class__.__name__,
ref_id = header.id,
remark = u"%s 删除该记录。" % session['user_profile']['name'],
))
DBSession.commit()
flash(MSG_DELETE_SUCC, MESSAGE_INFO)
return redirect(url_for('.view', action = 'index'))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:11,代码来源:order.py
示例19: view_items
def view_items(self):
id = _g('id')
w = DBSession.query(InventoryLocation).get(id)
ids = w.full_path_ids.split("|")
result = DBSession.query(InventoryItem, InventoryLocation).filter(and_(
InventoryItem.active == 0,
InventoryItem.location_id.in_(ids),
InventoryLocation.active == 0,
InventoryItem.location_id == InventoryLocation,
)).order_by(InventoryItem.create_time).all()
return {'result' : result , 'location' : w}
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:12,代码来源:warehouse.py
示例20: list_doctors
def list_doctors():
id = request.values.get("id", None)
if not id:
dps = DBSession.query(DoctorProfile).filter(DoctorProfile.active == 0)
# dps = connection.DoctorProfile.find({'active':0})
data = [dp.populate() for dp in dps]
else:
c = DBSession.query(Clinic).get(id)
# c = connection.Clinic.one({'active':0, 'id':int(id)})
# data = [connection.DoctorProfile.one({'id':i}).populate() for i in c.doctors]
data = [i.populate() for i in c.doctors]
return {"doctors": data}
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:12,代码来源:action.py
注:本文中的sys2do.model.DBSession类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论