pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.75k stars 1.57k forks source link

sqla search does not support columns with distinct attribute names #1973

Open gbrandt1 opened 4 years ago

gbrandt1 commented 4 years ago

Hi, I have a model where i had to use attribute names distinct from column names

id_ = db.Column('id', ...

This is not supported by the search because _apply_search uses getattr to find the column in case of aliased model, but the field.key is taken from the column name:

            column = field if alias is None else getattr(alias, field.key)

any suggestions how to fix this?

alexbadaloff commented 4 years ago

I think you need: column_searchable_list = (Table.id_,)