当前位置: 首页>>代码示例>>Python>>正文


Python Dataset.all_by_account方法代码示例

本文整理汇总了Python中spendb.model.Dataset.all_by_account方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.all_by_account方法的具体用法?Python Dataset.all_by_account怎么用?Python Dataset.all_by_account使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spendb.model.Dataset的用法示例。


在下文中一共展示了Dataset.all_by_account方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: query_index

# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
def query_index():
    q = Dataset.all_by_account(current_user, order=False)
    q = q.order_by(Dataset.updated_at.desc())

    # Filter by languages if they have been provided
    for language in request.args.getlist('languages'):
        l = aliased(DatasetLanguage)
        q = q.join(l, Dataset._languages)
        q = q.filter(l.code == language)

    # Filter by territories if they have been provided
    for territory in request.args.getlist('territories'):
        t = aliased(DatasetTerritory)
        q = q.join(t, Dataset._territories)
        q = q.filter(t.code == territory)

    # Return a list of languages as dicts with code, count, url and label
    languages = [{'code': code, 'count': count, 'label': LANGUAGES.get(code)}
                 for (code, count) in DatasetLanguage.dataset_counts(q)]

    territories = [{'code': code, 'count': count, 'label': COUNTRIES.get(code)}
                   for (code, count) in DatasetTerritory.dataset_counts(q)]

    pager = Pager(q, limit=15)
    return pager, languages, territories
开发者ID:annafralberts,项目名称:spendb,代码行数:27,代码来源:dataset.py

示例2: list_cubes

# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
 def list_cubes(self):
     cubes = []
     for dataset in Dataset.all_by_account(None):
         if not dataset.has_model:
             continue
         cubes.append({"name": dataset.name, "label": dataset.label})
     return cubes
开发者ID:trickvi,项目名称:spendb,代码行数:9,代码来源:provider.py

示例3: list_cubes

# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
 def list_cubes(self):
     cubes = []
     for dataset in Dataset.all_by_account(None):
         if not len(dataset.model.axes):
             continue
         cubes.append({
             'name': dataset.name,
             'label': dataset.label
         })
     return cubes
开发者ID:annafralberts,项目名称:spendb,代码行数:12,代码来源:provider.py


注:本文中的spendb.model.Dataset.all_by_account方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。