使用Flask-admin显示联接表时,
JoinTable
---------
JoinedTable_A.ID
JoinedTable_B.ID
JoinedTable_C.ID
...
admin.add_view(ModelView(JoinTable, db.session))
...
它智能地显示JoinedTable_X名称,而不是JoinedTable_X ID。
JoinTable
---------
JoinedTable_A.ID->Name
JoinedTable_B.ID->Name
JoinedTable_C.ID->Name
但是,如果JoinedTable_A.Name在行之间不是唯一的,那么这并不是很有用。更糟糕的是,如果允许该值为NULL(无),则接口会中断。
如果JoinedTable_A看起来像这样,
JoinedTable_A
-------------
ID
Name
Organization
有没有办法让联接表列显示' JoinedTable_A.Name + JoinedTable_A.Organization',而不仅仅是JoinedTable_A.Name?
JoinTable
---------
JoinedTable_A.ID->Name + JoinedTable_A.ID->Organization
JoinedTable_B.ID->Name
JoinedTable_C.ID->Name
到目前为止,我的研究指出了' get_list'功能在... flask-admin / contrib / sqla / view.py,但我很难搞清楚。