I am curious about how to approach dynamically updating Flask-Admin lists. I can toggle various settings with _handle_view, but changing column_lists and filter_lists doesn't seem to be an option. Example view:
class MyView(sqla.ModelView): column_list = ['first_name', 'last_name', 'phone', 'email'] column_searchable_list = ['first_name', 'last_name', 'phone',email'] column_filters = ['first_name', 'last_name', 'email'] can_create = Truedef is_accessible(self): if current_user.is_authenticated: return current_user.is_admin or current_user.has_permission('staff') def inaccessible_callback(self, name, **kwargs): flash('Authentication Required') return redirect(url_for('main.index')) def _handle_view(self, name, **kwargs): if not current_user.is_admin: self.can_create = False self.column_filters = ['first_name']
The above view alters the create option (or delete/edit/ boolean options in flask-admin), but _handle_view will not overwrite any of the list options like column_filters or column_list. At least as far as I can tell.
Anyone have experience with this or can point me in the right direction?