gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 00:56:42 24 4
gpt4 key购买 nike

我正在尝试结合 Flask-Admin 和 Flask S3 Tool Suite由某人编写,用于将图像存储到 Amazon S3 简单存储。我尝试专门使用的工具是 S3Saver 功能,在文章链接中,用户继续说要合并此工具,我最好在 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-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/ (搜索“来自”)

关于python - 有人可以告诉我在哪里可以找到 Flask-Admin 回调吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34798118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com