當前位置: 首頁>>代碼示例>>Python>>正文


Python Card.get_versions方法代碼示例

本文整理匯總了Python中models.card.Card.get_versions方法的典型用法代碼示例。如果您正苦於以下問題:Python Card.get_versions方法的具體用法?Python Card.get_versions怎麽用?Python Card.get_versions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.card.Card的用法示例。


在下文中一共展示了Card.get_versions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_card_route

# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import get_versions [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],
    }
開發者ID:Folashade,項目名稱:sagefy,代碼行數:32,代碼來源:card.py

示例2: get_card_versions_route

# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import get_versions [as 別名]
def get_card_versions_route(request, card_id):
    """
    Get versions card given an ID. Paginates.
    """

    versions = Card.get_versions(entity_id=card_id, **request['params'])
    return 200, {
        'versions': [version.deliver(access='view') for version in versions]
    }
開發者ID:Folashade,項目名稱:sagefy,代碼行數:11,代碼來源:card.py


注:本文中的models.card.Card.get_versions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。