HTMX + Django: Modern Python Web Apps, Hold the JavaScript Transcripts
Chapter: Feature 1: Click-to-edit
Lecture: The view for the form partial

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I'll just scroll down to the bottom of the page, and let me add the code. The view for the partial is pretty small.
0:18 It merely needs to render the form that got tucked away in its own file. Of course, the one thing to remember is what context info that partial needs.
0:27 In this case, it's the category object. The form needs that because the submission of the form uses the name of the category in the category view.
0:36 Okay, that's the view. Now let me register the route. Let's try it out. Heading to the browser. I'm starting here at the home page like before.
0:55 Picking Python. Scrolling down, and there's our link, including the Font Awesome icon. Let me click this. And there's our beautiful form.
1:11 Let's make sure I haven't broken anything by htmx-ifying and test it out. The page gets reloaded. And there's our new content.
1:26 Like I said, I think I'm in love...


Talk Python's Mastodon Michael Kennedy's Mastodon