本文整理汇总了Python中the_tale.accounts.prototypes.AccountPrototype._db_exclude方法的典型用法代码示例。如果您正苦于以下问题:Python AccountPrototype._db_exclude方法的具体用法?Python AccountPrototype._db_exclude怎么用?Python AccountPrototype._db_exclude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.accounts.prototypes.AccountPrototype
的用法示例。
在下文中一共展示了AccountPrototype._db_exclude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_exclude [as 别名]
def handle(self, *args, **options):
actions = set(AccountPrototype._db_exclude(action_id=None).values_list('action_id', flat=True).order_by('action_id').distinct())
for action_id in actions:
print()
print('----%s----' % action_id)
registered_ids = set(AccountPrototype._db_filter(action_id=action_id, is_fast=False).values_list('id', flat=True))
print('registrations: %d' % len(registered_ids))
payers_ids = set(InvoicePrototype._db_filter(models.Q(state=INVOICE_STATE.CONFIRMED)|models.Q(state=INVOICE_STATE.FORCED),
sender_type=ENTITY_TYPE.XSOLLA,
currency=CURRENCY_TYPE.PREMIUM).values_list('recipient_id', flat=True))
payers_ids &= registered_ids
print('payers: %d' % len(payers_ids))
amounts = InvoicePrototype._db_filter(models.Q(state=INVOICE_STATE.CONFIRMED)|models.Q(state=INVOICE_STATE.FORCED),
sender_type=ENTITY_TYPE.XSOLLA,
recipient_id__in=payers_ids,
currency=CURRENCY_TYPE.PREMIUM).values_list('amount', flat=True)
amount = sum(amounts)
print('total gold: %d' % amount)
if registered_ids:
print('per account: %.2f' % (float(amount) / len(registered_ids)))
if payers_ids:
print('per payer: %.2f' % (float(amount) / len(payers_ids)))
示例2: filter_recipients
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_exclude [as 别名]
def filter_recipients(cls, ids):
return set(AccountPrototype._db_exclude(membership__account__in=ids).values_list('id', flat=True))