How to edit flask-admin to support multi tenancy? How to edit flask-admin to support multi tenancy? flask flask

How to edit flask-admin to support multi tenancy?


Remove the field from being displayed in the form, then hook into on_model_change:

class MyDealModelView(ModelView):    form_excluded_columns = ('merchant_id',)    def on_model_change(form, model, is_created):        model.merchant_id = login.current_user.merchant_id;

http://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.on_model_change