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

preview_player
Показать описание
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.

▶️ Full Playlist:

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
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
19:22 Handling successful form submission
20:56 Updating URL with hx-push-url
21:58 Adding Logout functionality with HTMX

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:

#django #python #htmx
Рекомендации по теме
Комментарии
Автор

Mate your videos are like caviar 😩 always at the right moment and with real life needs ! Thank you infinitely 🙌

seydinaoumarsamabaly
Автор

Like Always... Great content and demo.

theindianhindu
Автор

Do you speed up your video or you really go at that speed in real life?

alexforget
Автор

Hello, I have a question please.

Have you been able to use CreateUserForm with the university form and not have to override the same method?

amine
Автор

Hello! I either missed it, or this function does not exist in htmx, namely, how to replace the class of another element with a trigger? Let's say I have a disabled feedback, I want to add the is-invalid class to its input.

Razilator
Автор

Awesome....do you have a link to the completed code..the 1st and 2nd videos is the starter only

mrmuranga
Автор

Thank you BugBytes, you are doing good as usual. I have a question that is, does Htmx support multiple target swap on an click event?

mohammadshafayethaydar
Автор

I make a lot of spa with your videos about django+crispy_forms+htmx.... i'm reviewing all searching if its possible to hide a field on a condition of another field dynamically... you cover that topic ? Thanks for all your videos ! Regards

LeandroGurruchaga