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

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So you've got the form coming in dynamically. Well, what about getting rid of it? Let's add a cancel button that reverts the form back to the link.
0:10 Let me pause here for a moment. Take a second and think about what needs to change. You've already got the tools you need to implement this.
0:18 Swapping the link back isn't terribly different from swapping the form. Cancel button will work a lot like the original click to edit link,
0:27 but replacing the form with the link instead of the other way around. So to do this, you'll need a new view that can serve the link as a partial,
0:36 a cancel button, and some HTMX on that button to do the swap. Let's go back into PyCharm and give this a try.

Talk Python's Mastodon Michael Kennedy's Mastodon