本文整理汇总了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)