'How to override flask_admin ModelView.get_list to get custom amount of entries

Now i get all entries in admin when i open page of MyView(ModelView). I want to manage this behaviour and get only, for example, 10 entries. I tried to override ModelView.get_query method in MyView like

def get_query(self):
     return current_app.db.session.query(MyModel).limit(10)

but this does not work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source