当前位置: 首页>>代码示例>>Python>>正文


Python Card.get方法代码示例

本文整理汇总了Python中models.card.Card.get方法的典型用法代码示例。如果您正苦于以下问题:Python Card.get方法的具体用法?Python Card.get怎么用?Python Card.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.card.Card的用法示例。


在下文中一共展示了Card.get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_user_ids

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
 def test_get_user_ids(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 str(uid0) in [user_id for user_id in card.get_user_ids()]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:9,代码来源:test_card.py

示例2: test_get_cards_by_list_id

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [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)]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:9,代码来源:test_card.py

示例3: test_get_and_test_description

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
 def test_get_and_test_description(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)
     card.set_description('desc')
     assert 'desc' in card.get_description()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:10,代码来源:test_card.py

示例4: test_set_and_get_card

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
 def test_set_and_get_card(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.title == 'card0'
     assert card.list_id == lid0
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:10,代码来源:test_card.py

示例5: get_version

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
def get_version(kind, id_):
    if kind == 'card':
        return Card.get(id=id_)
        # TODO-1 This needs to also get the right card kind...
    elif kind == 'unit':
        return Unit.get(id=id_)
    elif kind == 'set':
        return Set.get(id=id_)
开发者ID:Folashade,项目名称:sagefy,代码行数:10,代码来源:entity.py

示例6: incr_decr_get_comment

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
 def incr_decr_get_comment(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)
     Card.incr_comment(card_id)
     assert 1 == card.get_comment_count()
     Card.desc_comment(card_id)
     assert 0 == card.get_comment_count()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:12,代码来源:test_card.py

示例7: api_get_card

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
def api_get_card(card_id = None):
    if card_id == None:
        return jsonify({'code': 400, 'message': 'Bad Request'})
    else:
        card = Card.get(long(card_id))
        if card == None:
            return jsonify({'code': 404, 'message': 'Page Not Found'})
        _list = List.get(card.list_id)
        return render_template('card.html',
                                card=card,
                                list=_list,
                                edit_card_desc_form=EditCardDescForm(),
                                add_comment_form=AddCommentForm());
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:15,代码来源:views.py

示例8: api_edit_card

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
def api_edit_card(card_id = None):
    if card_id == None:
        return jsonify({'code': 400, 'message': 'Bad Request'})
    else:
        card = Card.get(long(card_id))
        if card == None:
            return jsonify({'code': 404, 'message': 'Page Not Found'})

    try:
        desc = request.form['desc']
        card.set_description(desc)
    except KeyError:
        return jsonify({'code': 400, 'message': 'Bad Request'})
    return jsonify({'code': 200, 'card_id':card_id}) 
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:16,代码来源:views.py

示例9: api_add_comment

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
def api_add_comment(card_id=None):
    if card_id == None:
        return jsonify({'code': 400, 'message': 'Bad Request'})
    else:
        card = Card.get(long(card_id))
        if card == None:
            return jsonify({'code': 404, 'message': 'Page Not Found'})
    
    try:
        content = request.form['comment']
    except:
        return jsonify({'code': 400, 'message': 'Bad Request'})

    comment = Comment.add(long(card_id), current_user.id, content)
    return jsonify({'card_id': card_id})
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:17,代码来源:views.py

示例10: test_add_and_get_cards

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
    def test_add_and_get_cards(self):
        uid0 = User.add("test_user1", "password", "[email protected]")
        user0 = User.get(uid0)
        uid1 = User.add("test_user2", "password", "[email protected]")
        user1 = User.get(uid1)
        bid0 = Board.add("board1", "A")
        lid0 = List.add("List0", bid0)

        caid0 = Card.add("card1", lid0, uid0)
        caid1 = Card.add("card2", lid0, uid1)
        card0 = Card.get(caid0)


        print caid0, user0.get_card_ids()
        assert str(caid0) in user0.get_card_ids()
        assert str(caid1) not in user0.get_card_ids()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:18,代码来源:test_user.py

示例11:

# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import get [as 别名]
user1.add_board(board0)
user1.add_board(board1)
user2.add_board(board0)

user0.set_avatar('http://127.0.0.1:5000/_uploads/images/avatar_1.png')
user1.set_avatar('http://127.0.0.1:5000/_uploads/images/avatar_2.png')

lid0 = List.add("To Do", bid0)
lid1 = List.add("Doing", bid0)
lid2 = List.add("Done", bid0)

caid0 = Card.add("card1", lid0, uid0)
caid1 = Card.add("card2", lid0, uid0)
caid2 = Card.add("card3", lid1, uid0)

card0 = Card.get(caid0)
card0.add_user(user1)
card0.add_user(user2)

coid0 = Comment.add(caid0, uid0, "comment1")
coid1 = Comment.add(caid0, uid1, "comment2")
coid2 = Comment.add(caid0, uid2, "comment3")



'''
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from models.user import User
from models.board import Board
from models.list import List
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:33,代码来源:test_data.py


注:本文中的models.card.Card.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。