Initialize Fonrey Django multi-tenant project skeleton
Set up the required directory layout, app scaffolding, core settings, templates, static assets, and Docker/Tailwind tooling to establish a standardized development baseline.
This commit is contained in:
15
core/htmx.py
Normal file
15
core/htmx.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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