【发布时间】:2021-06-10 19:33:09
【问题描述】:
我已经放弃了这篇文章Customizing the flask admin row actions,但我总是得到 jinja2.exceptions.TemplateNotFound: my_list.html。我不知道为什么。
from app import db, app
from flask_admin import Admin, expose
from flask_admin.contrib.sqla import ModelView
from app.models import User, Post
from flask_admin.model.template import EndpointLinkRowAction, LinkRowAction, TemplateLinkRowAction
class MyView(ModelView):
list_template = "my_list.html" # Override the default template
column_extra_row_actions = [ # Add a new action button
TemplateLinkRowAction("custom_row_actions.copy_row", "Copy Record"),
]
@expose("/copy", methods=("POST",))
def copy_view(self):
pass
#The method you need to call """
admin = Admin(app, name='microblog', template_mode='bootstrap3')
admin.add_view(MyView(User, db.session))
admin.add_view(ModelView(Post, db.session))
post 正在运行,管理界面也在运行,但是当我在管理中按下用户按钮时,我收到了我已经提到过的消息
这是我的目录树: enter image description here
【问题讨论】:
标签: flask flask-admin