2

我正在尝试使用小马 orm 来查看是否存在主键。我做到了这一点,但它总是抛出一个错误。

class Favorite(db.Entity):
    game = Required(Game)
    user = Required(User)
    date_favorited = Required(datetime)
    PrimaryKey(user, game)

这是功能

    if Favorite.get(lambda: user, game) is not None:
        favorited = 1

这是错误

TypeError: The second positional arguments should be globals dictionary. Got: Game[12]
4

1 回答 1

2

github repo中得到帮助

if Favorite.exists(user=x, game=y):
    favorited = 1
于 2015-07-08T10:52:55.373 回答