本文整理汇总了Python中models.card.Card.list_requires方法的典型用法代码示例。如果您正苦于以下问题:Python Card.list_requires方法的具体用法?Python Card.list_requires怎么用?Python Card.list_requires使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.card.Card
的用法示例。
在下文中一共展示了Card.list_requires方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_card_route
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import list_requires [as 别名]
def get_card_route(request, card_id):
"""
Get a specific card given an ID. Show all relevant data, but
not used for the learning interface.
"""
card = get_card_by_kind(card_id)
if not card:
return abort(404)
unit = Unit.get_latest_accepted(entity_id=card['unit_id'])
if not unit:
return abort(404)
# TODO-2 SPLITUP create new endpoints for these instead
topics = Topic.list_by_entity_id(entity_id=card_id)
versions = Card.get_versions(entity_id=card_id)
requires = Card.list_requires(entity_id=card_id)
required_by = Card.list_required_by(entity_id=card_id)
params = CardParameters.get(entity_id=card_id)
return 200, {
'card': card.deliver(access='view'),
'card_parameters': params.get_values(),
'unit': unit.deliver(),
'topics': [topic.deliver() for topic in topics],
'versions': [version.deliver() for version in versions],
'requires': [require.deliver() for require in requires],
'required_by': [require.deliver() for require in required_by],
}