有人可以告诉我在哪里可以找到 Flask-Admin 回调吗?

Could someone please show me where I can find Flask-Admin callbacks?

我正在尝试结合 Flask-Admin 和某人编写的 Flask S3 Tool Suite 将图像存储到 Amazon S3 简单存储。我尝试专门使用的工具是 S3Saver 功能,在文章 link 中,用户继续说要合并此工具,我最好在 flask-admin 回调中使用它。

但是,我无法在任何地方找到 Flask-Admin 回调列表。我已经完成了我的作业,并且我已经从字面上检查了这些回调的整个文档和源代码 Flask-Admin documentation

flask_admin.contrib.sqla 中,我发现了一些类似于回调的方法,但它不是我要找的。我想它是接近 Rails 的 before_actionafter_action 的东西。有人可以给我指出正确的方向吗?

顺便说一句,这是文章

中的实际引用

If you wanted to handle deleting files in the admin as well, you could (for example) use s3-saver, and hook it in to one of the Flask-Admin event callbacks

那些回调是什么?

这是 Flask 管理事件的文档:

https://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask_admin.model.BaseModelView.on_form_prefill

on_form_prefill(form, id) Perform additional actions to pre-fill the edit form.

Called from edit_view, if the current action is rendering the form rather than receiving client side input, after default pre-filling has been performed.

By default does nothing.

You only need to override this if you have added custom fields that depend on the database contents in a way that Flask-admin can’t figure out by itself. Fields that were added by name of a normal column or relationship should work out of the box.

Parameters: form – Form instance id – id of the object that is going to be edited

on_model_change(form, model, is_created) Perform some actions before a model is created or updated.

Called from create_model and update_model in the same transaction (if it has any meaning for a store backend).

By default does nothing.

Parameters: form – Form used to create/update model model – Model that will be created/updated is_created – Will be set to True if model was created and to False if edited

on_model_delete(model) Perform some actions before a model is deleted.

Called from delete_model in the same transaction (if it has any meaning for a store backend).

By default do nothing.

Flask-Admin 回调函数(据我所知)

after_model_change(form, model, is_created)
#Called from create_model after successful database commit.

after_model_delete(model)
#Called from delete_model after successful database commit (if it has any meaning for a store backend).


on_form_prefill(form,id) 
# Called from edit_view, if the current action is rendering the form rather than receiving client side input, after default pre-filling has been performed.

on_model_change(form,model,is_created) 
#Called from create_model and update_model in the same transaction (if it has any meaning for a store backend).

on_model_delete(model) 
# Called from delete_model in the same transaction (if it has any meaning for a store backend).

更多信息在 http://flask-admin.readthedocs.org/en/latest/api/mod_model/(搜索 "Called from")