Skip to content

Commit

Permalink
Get class attributes on views in time (form overrides work now)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Peterson committed Aug 19, 2019
1 parent 783c91f commit 8524959
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flask_secure_admin/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8524959

Please sign in to comment.