I would like to display only paid orders in my Flask-Admin model list view.
Here is models.py:
class Order(db.Model):
id = db.Column(db.Integer, primary_key=True)
amount = db.Column(db.Integer)
description = db.Column(db.String)
paid = db.Column(db.Boolean, default=False)
Here is ModelView for Flask-Admin:
class OrderView(ModelView):
column_filters = ("paid")
admin.add_view(OrderView(Order, db.session))
Filters work fine, but I would like to make this filter default. Or better yet, do not use filters, and only show orders that are output of Order.query.filter(Order.paid==True)
query.
Is it possible to do with Flask-Admin?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…