本文整理匯總了Python中freepybx.model.meta.Session.query方法的典型用法代碼示例。如果您正苦於以下問題:Python Session.query方法的具體用法?Python Session.query怎麽用?Python Session.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類freepybx.model.meta.Session
的用法示例。
在下文中一共展示了Session.query方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: register_login
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def register_login(class_, username, session, request):
user = db.query(AdminUser).filter(AdminUser.username==username).first()
if user:
now = datetime.now()
user.last_login = now
user.session_id = session.id
user.remote_addr = request.environ["HTTP_REMOTE_EU"]
db.commit()
db.flush()
db.remove()
示例2: get_customer_name
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_customer_name(class_, customer_id):
customer = db.query(Customer).filter(Customer.id==customer_id).first()
if customer:
return customer.name
示例3: get_email_account
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_email_account(self):
email = db.query(EmailAccount).filter(EmailAccount.user_id==self.id).first()
if email:
return email
示例4: get_context
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_context(self):
co = db.query(Customer).filter(Customer.id==self.customer_id).first()
return co.context
示例5: get_groups
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_groups(self):
return db.query(Group.name).join(UserGroup).filter(UserGroup.user_id==self.id).all()
示例6: has_call_center
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def has_call_center(self):
co = db.query(Customer).filter(Customer.id==self.customer_id).first()
return co.has_call_center
示例7: get_gateway
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_gateway(self):
gw = db.query(PbxContext.gateway).join(Customer).join(User).filter(User.customer_id==Customer.id).first()
return 0 if not gw else gw[0]
示例8: by_domain
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def by_domain(self, domain=None):
return Session.query(PbxContext).filter_by(domain=domain).first()
示例9: get_gateways
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def get_gateways(self):
return Session.query(PbxGateway).filter_by(pbx_profile_id=self.id)
示例10: index
# 需要導入模塊: from freepybx.model.meta import Session [as 別名]
# 或者: from freepybx.model.meta.Session import query [as 別名]
def index(self, category):
return db.query(Help)