.
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user