当我根据该模型中的布尔值进入django管理界面时,我想为模型显示两个单独的表。例如,在admin.py中我有:
class MyModelsAdmin(admin.ModelAdmin):
list_display = ('Name', 'user', 'sample', 'experiment', 'reported')
和'reported'是一个布尔值。我想显示两个表,报告和未报告。有没有办法在我的MyModelsAdmin类中执行此操作?类似的东西:
class MyModelsAdmin(admin.ModelAdmin):
list_display = ('Name', 'user', 'sample', 'experiment', 'reported')
if reported == True:
... display table with header Reported ...
elif reported == False:
... display table with header Not Reported ...
else:
pass