本文整理匯總了Python中models.card.Card.get_cards_by_list_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Card.get_cards_by_list_id方法的具體用法?Python Card.get_cards_by_list_id怎麽用?Python Card.get_cards_by_list_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.card.Card
的用法示例。
在下文中一共展示了Card.get_cards_by_list_id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_cards_by_list_id
# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import get_cards_by_list_id [as 別名]
def test_get_cards_by_list_id(self):
uid0 = User.add("test1", "password", "[email protected]")
bid0 = Board.add("board1", "A")
lid0 = List.add("To Do", bid0)
card_id = Card.add("card0", lid0, uid0)
card = Card.get(card_id)
assert card_id in [card.id for card in Card.get_cards_by_list_id(lid0)]
示例2: api_card
# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import get_cards_by_list_id [as 別名]
def api_card(list_id = None):
if request.method == 'GET':
list_id = request.args.get('list_id')
if list_id != None:
cards = Card.get_cards_by_list_id(list_id)
return jsonify(json_list=[card.serialize() for card in cards])
else:
return jsonify({'code': 404, 'message': 'Card ID not valid.'})
else:
try:
list_id = long(request.form['list_id'])
title = request.form['title']
except KeyError:
return jsonify({'code': 400, 'message': 'Bad Request'})
return jsonify({"card_id": Card.add(title, list_id, current_user.id)})
示例3: get_cards
# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import get_cards_by_list_id [as 別名]
def get_cards(self):
return Card.get_cards_by_list_id(self.id)