bitter-monkey-50309
11/09/2022, 11:25 PMblue-gold-89534
11/11/2022, 3:13 PMpython
def downloadCheck(request, pk):
icon = f"""<img src="{static('images/arrow.svg')}">"""
tmp = f"""download/{pk}"""
return HttpResponse(content = format_html(f"""{icon}"""), headers = {"hx-redirect": f"""download/{pk}"""})
def download(request, pk):
PATH = ...
return FileResponse(open(PATH, "rb"), content_type = "image/PNG", as_attachment = True)
therefore I got another entry in the urls.py:
python
urlpattterns = [
path("downloadcheck/<int:pk>", views.downloadCheck, name = "downloadCheck"),
path("download/<int:pk>", views.download, name = "download"),
]blue-gold-89534
11/11/2022, 3:14 PMif request.hmx:,?)bitter-monkey-50309
11/12/2022, 1:36 PMblue-gold-89534
11/12/2022, 2:09 PM