This commit is contained in:
Ross
2025-12-09 11:37:49 +00:00
parent 91b6fdd733
commit 5a2704b1d2
2 changed files with 20 additions and 0 deletions
+18
View File
@@ -144,6 +144,24 @@ def rota_run_detail(request, run_id):
return render(request, "rota/rota_run_detail.html", {"run": run})
def rota_run_export_html(request, run_id):
from .models import RotaRun
run = get_object_or_404(RotaRun, pk=run_id)
return render(request, "rota/rota_run_export.html", {"run": run})
def rota_run_export_download(request, run_id):
from .models import RotaRun
run = get_object_or_404(RotaRun, pk=run_id)
html = render_to_string("rota/rota_run_export.html", {"run": run}, request=request)
response = HttpResponse(html, content_type="text/html; charset=utf-8")
filename = f"rota_run_{run.id}_export.html"
response["Content-Disposition"] = f'attachment; filename="{filename}"'
return response
@require_http_methods(["GET", "POST"])
def shift_add(request, rota_id):
"""HTMX endpoint to render a shift form or accept submission to append a shift to the rota."""