课程:
class User(flask_db.Model, UserMixin):
id = PrimaryKeyField()
social_id = CharField(null=False, unique=True)
nickname = CharField(null=False)
email = CharField(null=True)
class Feed(flask_db.Model):
id = PrimaryKeyField()
user = ForeignKeyField(User, related_name='feeds')
title = CharField()
url = CharField()
description = CharField()
如果我这样做:
newfeed = Feed.create(..)
我应该在类型 id 和类型 user 中输入什么?
我应该如何获取用户的所有提要?有这样的东西?
feedsofuserTom = Feed.select().where(Feed.user == userTom)
我不了解 ForeignKeyField() 函数,我阅读了文档,但这些示例对我不起作用。 http://docs.peewee-orm.com/en/latest/peewee/models.html