Hi! i'm currently having these Models:
conn_tags_table = sql.Table('conn_tags', Base.metadata, sql.Column('conn_id', sql.Integer, ForeignKey( 'connection.id')), sql.Column('tag_id', sql.Integer, ForeignKey('tag.id')) ) class Connection(Base): """ Connection tables """ __tablename__ = "connection" #__table_args__ = (sql.UniqueConstraint('url', 'port', name='unique_url_port'),) id = sql.Column(sql.Integer, primary_key=True) conn_type = sql.Column(sql.String(30)) url = sql.Column(sql.Text) ip = sql.Column(sql.Text) port = sql.Column(sql.Integer) answer = sql.Column(sql.String(50)) redirect = sql.Column(sql.Text) tags = relationship('Tag', secondary=lambda: conn_tags_table) def __unicode__(self): return "%d -> %s" % (self.id, self.url) def __str__(self): return "%d -> %s -> %d" % (self.id, self.url, self.port) class Tag(Base): """ Table for tags """ __tablename__ = "tag" id = sql.Column(sql.Integer, primary_key=True) name = sql.Column(sql.Text, unique=True) desc = sql.Column(sql.Text) def __unicode__(self): return self.name def __str__(self): return self.name And these are my views: class ConnectionAdmin(sqla.ModelView): column_display_pk = False form_columns = ['conn_type', 'url', 'port', 'answer', 'redirect', 'tags' ] column_searchable_list = ('conn_type', 'url', 'answer', 'redirect', 'ip' , Tag.name) column_filters = ('conn_type', 'url', 'port', 'answer', 'redirect', 'ip' , Tag.name) # Define which fields should be preloaded by Ajax form_ajax_refs = { 'tags': { 'fields': (Tag.name,) } } I'm using *flask-admin* for all the "magic stuff". All I want to do is to be able to search in "Tag.name" as well. Besides that I want to filter by "Tag.name". However when I search for some tags, nothing happens. And filtering for some tag (http://127.0.0.1:5000/admin/connection/?flt1_24=Dead) leads to: sqlalchemy.exc.InvalidRequestError sqlalchemy.exc.InvalidRequestError: Could not find a FROM clause to join from. Tried joining to tag, but got: Can't find any foreign key relationships between 'connection' and 'tag'. I've found some solution <http://codeseekah.com/2013/08/04/flask-admin-hacks-for-many-to-many-relationships/> but that didn't work for me. Any hints/ideas would be appreciated. Cheers, Peter -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.