blue-gold-89534
10/26/2022, 1:49 PMpython
def start_dl(request, pk):
o = Model.objects.get(pk = pk)
try:
return FileResponse(open(o.file), 'rb'), as_attachment = True)
except Model.DoesNotExist:
m = f"""<img src="{static('images/alert.svg')}" hx-swap-oob="true" hx-targt="download-{o.pk}"> """
return HttpResponse(format_html(m))
html
<a href="{% url 'download' something.pk %}">
<img src="{% static 'images/dl.svg' %}" id="download-{{object.pk}}">Download
</a>
Everything works so far but after a click on Download I always get a new site instead of only the new icon in place? Is it, because I am not using an hx-get but a d