本文整理汇总了Python中tracim_backend.lib.core.content.ContentApi.get_last_active方法的典型用法代码示例。如果您正苦于以下问题:Python ContentApi.get_last_active方法的具体用法?Python ContentApi.get_last_active怎么用?Python ContentApi.get_last_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim_backend.lib.core.content.ContentApi
的用法示例。
在下文中一共展示了ContentApi.get_last_active方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: account_contents_read_status
# 需要导入模块: from tracim_backend.lib.core.content import ContentApi [as 别名]
# 或者: from tracim_backend.lib.core.content.ContentApi import get_last_active [as 别名]
def account_contents_read_status(self, context, request: TracimRequest, hapic_data=None): # nopep8
"""
get user_read status of contents
"""
app_config = request.registry.settings['CFG']
content_filter = hapic_data.query
api = ContentApi(
current_user=request.current_user, # User
session=request.dbsession,
config=app_config,
)
wapi = WorkspaceApi(
current_user=request.current_user, # User
session=request.dbsession,
config=app_config,
)
workspace = None
if hapic_data.path.workspace_id:
workspace = wapi.get_one(hapic_data.path.workspace_id)
last_actives = api.get_last_active(
workspace=workspace,
limit=None,
before_content=None,
content_ids=hapic_data.query.content_ids or None
)
return [
api.get_content_in_context(content)
for content in last_actives
]
示例2: account_last_active_content
# 需要导入模块: from tracim_backend.lib.core.content import ContentApi [as 别名]
# 或者: from tracim_backend.lib.core.content.ContentApi import get_last_active [as 别名]
def account_last_active_content(self, context, request: TracimRequest, hapic_data=None): # nopep8
"""
Get last_active_content for user
"""
app_config = request.registry.settings['CFG']
content_filter = hapic_data.query
api = ContentApi(
current_user=request.current_user, # User
session=request.dbsession,
config=app_config,
)
wapi = WorkspaceApi(
current_user=request.current_user, # User
session=request.dbsession,
config=app_config,
)
workspace = None
if hapic_data.path.workspace_id:
workspace = wapi.get_one(hapic_data.path.workspace_id)
before_content = None
if content_filter.before_content_id:
before_content = api.get_one(
content_id=content_filter.before_content_id,
workspace=workspace,
content_type=content_type_list.Any_SLUG
)
last_actives = api.get_last_active(
workspace=workspace,
limit=content_filter.limit or None,
before_content=before_content,
)
return [
api.get_content_in_context(content)
for content in last_actives
]