diff --git a/flask_secure_admin/blueprint.py b/flask_secure_admin/blueprint.py index 1c2af82..18b2030 100644 --- a/flask_secure_admin/blueprint.py +++ b/flask_secure_admin/blueprint.py @@ -126,9 +126,11 @@ def add_layout_to_admin(self, admin, app, db, options): self.models, self.view_options, fillvalue={}): model = getattr(db, model_name) model = override___name___on_sqlsoup_model(model) - model_view = SecureModelView(model, db.session) - for option_key, option_value in view_options_bag.items(): - setattr(model_view, option_key, option_value) + DerviedModelViewCls = \ + type(f'Secure{model.__name__}View', + (SecureModelView,), + view_options_bag) + model_view = DerviedModelViewCls(model, db.session) admin.add_view(model_view) return admin