From 5de97c5ee0723e1fcf34faf1211c079437502d4e Mon Sep 17 00:00:00 2001 From: Ross Date: Fri, 5 Dec 2025 22:04:09 +0000 Subject: [PATCH] . --- cards/templates/cards/_backgrounds_list.html | 4 ++-- cards/templates/cards/_card_item.html | 2 +- cards/views.py | 9 +++++++-- db.sqlite3 | Bin 143360 -> 143360 bytes 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cards/templates/cards/_backgrounds_list.html b/cards/templates/cards/_backgrounds_list.html index 62b0d20..d4690b1 100644 --- a/cards/templates/cards/_backgrounds_list.html +++ b/cards/templates/cards/_backgrounds_list.html @@ -1,7 +1,7 @@
{% for bg in backgrounds %} -
+
@@ -13,7 +13,7 @@ {% else %} Active {% endif %} - +
diff --git a/cards/templates/cards/_card_item.html b/cards/templates/cards/_card_item.html index 5726ac1..e87c476 100644 --- a/cards/templates/cards/_card_item.html +++ b/cards/templates/cards/_card_item.html @@ -52,7 +52,7 @@
- +
diff --git a/cards/views.py b/cards/views.py index 2e1bae7..bc82dbc 100644 --- a/cards/views.py +++ b/cards/views.py @@ -140,7 +140,10 @@ def card_delete(request, pk): if request.method == 'POST': card.delete() if is_htmx(request): - return HttpResponse(status=204) + # Return an empty 200 response so HTMX can replace the + # targeted element (e.g. via `hx-swap="outerHTML"`) and + # remove it from the DOM immediately. + return HttpResponse('') return redirect('cards:list') return HttpResponseBadRequest('Only POST allowed') @@ -197,7 +200,9 @@ def background_delete(request, pk): bg = get_object_or_404(BackgroundImage, pk=pk) bg.delete() if is_htmx(request): - return HttpResponse(status=204) + # See comment in `card_delete`: return empty body so HTMX can + # remove the corresponding element via `hx-swap="outerHTML"`. + return HttpResponse('') return redirect('cards:backgrounds') diff --git a/db.sqlite3 b/db.sqlite3 index 8cecf628cf3f66b210c627bcacebe40f18078a79..4a0b5bbad95d894acdaddc51271454a291f5b921 100644 GIT binary patch delta 241 zcmZp8z|ru4V}dke@>w^1kj2K# O0%9_Q2qtD`22KE>e?0L3 delta 239 zcmZp8z|ru4V}dke+(a2?#<-0M3;UJ%6&MtlDjE1<_-FC$<2U8~%-hB*%CmvTk^2gF zGS@GzUM`u*QWI1*I|>*wZLXZOn4Kk`pO0a)!YpS-mV6!{D}DAlAd7>KVY1}hT$XHh zpitM`nT(90%_{S^tITJ-+n~t6z@WgNz`*~9|2zLD{^$IU`0w)H;J?g&j{hY85&r%B zyQWJiFsW@;R9M3|{fi#cF*g=w21b4m!3QFEK?Dzo;06&~Ac7M_aDWJQ5W&XE%*e>h O0%9_Q2qtD`22KFs-!{Df