本文整理汇总了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)