【发布时间】:2015-09-08 08:57:59
【问题描述】:
我有 2 个模型:Post 和 Comment,一个帖子有很多 cmets,如何过滤 cmets.count() 小于 2 的帖子?
Post: id(primary key), body, author_id, comments
Comment: id(primary key), body, author_id, post_id
在哪里,
comments = db.relationship('Comment', backref='post', lazy='dynamic')
非常感谢!!
【问题讨论】:
标签: python relationship flask-sqlalchemy