HTMX + Django: Modern Python Web Apps, Hold the JavaScript Transcripts
Chapter: Feature 1: Click-to-edit
Lecture: Creating the partials template for the form
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
The first thing I need to do is get rid of the form from the Category Template page. Of course, I'm going to need it later, so rather than delete it,
0:08
I'm going to scroll it away in its own file. HTMX is designed on the idea that HTML snippets can be passed around instead of entire pages.
0:18
The structure of that on the server means having views that render those snippets.
0:22
I'm going to show you a couple of different ways of doing that in the course, but each time you're going to need to render some snippet.
0:30
It makes sense then to keep those little chunks of HTML in their own templates. These are often called partials.
0:37
I'm going to create a directory so I can keep all my partials together. Inside that, I need a new file that I want to move the form into.
0:53
I'm going to call it ""add-video-form.html"". Go back to the category page and grab the form.