本文整理汇总了Python中models.account.Account._r方法的典型用法代码示例。如果您正苦于以下问题:Python Account._r方法的具体用法?Python Account._r怎么用?Python Account._r使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.account.Account
的用法示例。
在下文中一共展示了Account._r方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listActiveAccounts
# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import _r [as 别名]
def listActiveAccounts(cls):
from models.account import Account
return Account.query\
.filter(~Account.status.in_(Account._r(Account.STATUS_DELETED)))\
.order_by(Account.first_name, Account.last_name, Account.alias)\
.all()
示例2: listActiveReports
# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import _r [as 别名]
def listActiveReports(cls, start_date=None, end_date=None, accounts=None, components=None):
from models.account import Account
from models.project import Project, Component
from models.report import Report
query = Report.query\
.filter(~Report.status.in_(Report._r(Report.STATUS_DELETED)))\
.join(Report.account)\
.filter(~Account.status.in_(Account._r(Account.STATUS_DELETED)))\
.join(Report.component, aliased=True)\
.filter(~Component.status.in_(Component._r(Component.STATUS_DELETED)))\
.join(Report.project, aliased=True)\
.filter(~Project.status.in_(Project._r(Project.STATUS_DELETED)))
if start_date:
query = query.filter(Report.due_date>=start_date)
if end_date:
query = query.filter(Report.due_date<=end_date)
if accounts:
query = query.filter(Report.account_id.in_(accounts))
if components:
query = query.filter(Report.component_id.in_(components))
query = query.order_by(Account.first_name, Account.last_name, Account.alias, Report.due_date, Report.created)
return query.all()