清空,重构
This commit is contained in:
15
core/htmx.py
15
core/htmx.py
@@ -1,15 +0,0 @@
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def htmx_response(content="", status=200, toast=None, redirect=None):
|
||||
"""
|
||||
toast: {"type": "success|error|warning|info", "message": "..."}
|
||||
"""
|
||||
response = HttpResponse(content, status=status)
|
||||
if toast:
|
||||
import json
|
||||
|
||||
response["HX-Trigger"] = json.dumps({"fonrey:toast": toast})
|
||||
if redirect:
|
||||
response["HX-Redirect"] = redirect
|
||||
return response
|
||||
Reference in New Issue
Block a user