Проверьте, существует ли PrimaryKey с помощью ponyorm

Я пытаюсь использовать pony 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]

person nadermx    schedule 08.07.2015    source источник


Ответы (1)


Нам помогли в репозитории github

if Favorite.exists(user=x, game=y):
    favorited = 1
person nadermx    schedule 08.07.2015