mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Made show_messages available to plugins, closes #864
This commit is contained in:
parent
7ac4936cec
commit
a8a5f81372
4 changed files with 17 additions and 3 deletions
|
|
@ -192,10 +192,13 @@ def register_routes():
|
|||
|
||||
def add_message(datasette, request):
|
||||
datasette.add_message(request, "Hello from messages")
|
||||
print("Adding message")
|
||||
print(request._messages)
|
||||
return Response.html("Added message")
|
||||
|
||||
async def render_message(datasette, request):
|
||||
return Response.html(
|
||||
await datasette.render_template("render_message.html", request=request)
|
||||
)
|
||||
|
||||
return [
|
||||
(r"/one/$", one),
|
||||
(r"/two/(?P<name>.*)$", two),
|
||||
|
|
@ -204,6 +207,7 @@ def register_routes():
|
|||
(r"/csrftoken-form/$", csrftoken_form),
|
||||
(r"/not-async/$", not_async),
|
||||
(r"/add-message/$", add_message),
|
||||
(r"/render-message/$", render_message),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue