Set up the required directory layout, app scaffolding, core settings, templates, static assets, and Docker/Tailwind tooling to establish a standardized development baseline.
16 lines
429 B
Python
16 lines
429 B
Python
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
|