News for hackers. Stuff that matters.
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o... by dagw on Tuesday November 23, 2021 @11:10AM (#29319502)
you have to start from the beginning and write an API now.

Is it really that much more work? Much of the time the big difference is just be replacing

   return render(my_template, my_data)
with

   return to_json(my_data)
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o... by acdha on Tuesday November 23, 2021 @11:34AM (#29319825)
A few years back, I implemented this as a Django CBV which worked quite well:

https://github.com/LibraryOfCongress/concordia/blob/main/con...

That handles a few things like pagination for list views, calling get_absolute_url() on objects in the template context which have that method defined, and running all URLs through request.build_absolute_uri().