根据flask appbuilder的文档,Model详细视图的显示顺序可以定义如下:
class DeviceView(ModelView):
datamodel = SQLAInterface(Device)
related_views = [ApplicationView, EventView]
label_columns = {'snr':'SNR', 'api_dev_id':'Device ID', 'api_dev_key':'Device Key','owner_id':'Owner'}
list_columns = ['name','snr','addr','owner']
show_fieldsets = [
('Summary',
{'fields':['name','snr','owner']}
),
('Device Info',
{'fields': ['addr','latitude','longitude','status','api_id','api_key','api_dev_id','api_dev_key'],'expanded':True}
),
]
它适用于详细视图。但我找不到编辑视图的定义。这是我的设备编辑页面的快照。订单似乎是随机的。
我是否错过了文档中的任何部分?
答案 0 :(得分:0)
我从另一个问题找到答案:
Ordering data in a Flask Appbuilder view
class RegistrationTestView(ModelView ):
datamodel = SQLAInterface(RegistrationTest)
name = "RegistrationTestView"
page_size=1000
label_columns = {'CarNo':'Car #', 'FirstName':'First Name','LastName':'Last Name'}
list_columns = ['CarNo','FirstName','LastName']
edit_columns = ['FirstName','LastName']
show_columns = edit_columns
add_columns = edit_columns
order_columns = ['FirstName']
编辑/列表/节目中的显示是单独订购的。