django-crispy-forms and HTMX integration #2 - User Registration and Login/Logout

This video extends the basic crispy-forms setup from the previous video, and gives users the ability to register and login/logout to our Django application. We create a User model to persist users to the database, then attach some HTMX attributes to the form in order to perform actions without refreshing our page. When registering, users are automatically logged-in and sent to a profile page. Logging out will redirect back to our Django form. We will demonstrate a new HTMX concept in this video - use of the “Hx-Push“ HTTP header to instruct the client to push a new URL to the browser history. 📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀: 00:00 Intro 00:32 Creating User model that extends AbstractUser 04:28 Converting form to ModelForm 07:58 Handling form POST request in View 10:39 Adding form field validation method 13:02 Updating form to use HTMX 18:41 Creating template 19:22 Handling successful form submission 20:56 Updating URL with hx-push-url 21:58 Adding Logout functionality with HTMX ☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲: To support th
Back to Top