0
class Tag(Base):
__tablename__ = 'tags'
id = Column(Integer, primary_key=True, autoincrement=True)
slug = Column(String(50), unique=True, nullable=False)
class Post(Base):
__tablename__ = 'posts'
id = Column(Integer, primary_key=True, autoincrement=True)
title = Column(String(200), unique=True, nullable=False)
tags = relationship('Tag', secondary=posts_tags, backref='posts')
created_time = Column(Date, default=date.today())
content = Column(Text)
,我可以按標籤過濾的帖子:tag.posts
,但我無法過濾的帖子收集使用表達式tag.posts.filter(Post.id > 10).all()
如Django模型。SQLAlchemy的許多一對多的關係,如何過濾收集
那麼如何過濾多對多的集合呢?