12 Making your pages more dynamic with HTMX

This chapter covers

  • Using HTMX to add on-page interactivity to your Django project
  • Lazy loading
  • Search-as-you-type
  • Infinite scroll
  • Click to edit

On its own, Django is structured for older-style web interactions, with each action causing a new page to be loaded. Modern web frameworks, like React and Angular, can be used on top of an API, but the HTMX library allows for a high degree of interactivity without a lot of additional JavaScript code.

12.1 Dynamic web pages

Django was created in a time when there was a one-to-one relationship between a URL and a web page. Web pages were relatively static, with JavaScript mostly used to snazz the page up a little, by highlighting the current page ...

Get Django in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.