In the current pymongo implementation of the get_list method in the ModelView class, the default query is defined as {}. There is no way to override this query without overriding get_list, which makes the code less maintainable. For example, the sqla contribution allows you to override the get_query when subclassing the ModelView.
I propose to include a get_query call in the get_list method. This change would allow developers to override only the get_query method and pre-filter the database so that only relevant results are displayed according to the specific parameters of the use case.
In the current
pymongo
implementation of theget_list
method in theModelView
class, the default query is defined as{}
. There is no way to override this query without overridingget_list
, which makes the code less maintainable. For example, thesqla
contribution allows you to override theget_query
when subclassing theModelView
.I propose to include a
get_query
call in theget_list
method. This change would allow developers to override only theget_query
method and pre-filter the database so that only relevant results are displayed according to the specific parameters of the use case.Proposed change:
Revise
get_list
inModelView
to callget_query
:I will be happy to make a pull request if you would like to integrate this into the
pymongo
contribution.