Django - Building Form Wizards with formtools and django-crispy-forms

preview_player
Показать описание
In this video, we'll build a 3-step form-wizard using Django and the django-formtools package. We'll create 3 subforms that are displayed one-after-another in our form wizard, and then will handle the submission of the three forms by creating database rows and foreign keys between the different entities.

We will use some basic tools from django-crispy-forms to style up each form in the Wizard.

We will also look at CONDITIONALLY showing certain steps/forms in our wizard.

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:26 Installing django-formtools
03:52 Overview of Django Formtools Wizard
05:07 Creating ModelForm class for Guest Details
06:35 Creating formtools SessionWizardView
08:19 Adding form wizard to a Django template
10:07 Adding django-crispy-forms to improve form styles
11:23 Adding second form to the form-wizard
12:57 Adding third form to the form-wizard
15:00 Showing form steps conditionally in the form-wizard
18:27 Creating database objects from form-wizard submission data

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

▶️ Full Playlist:

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

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

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

I just discovered your channel. Thanks for all those great tutorials you are putting out on here.

yakubuabdullatif
Автор

wow you are a wizard by reading my mind.. I was just struggling with this :) thanks a lot for the video

ajdemoedable
Автор

Nice as always, waiting for full stack app 😁

atoprak
Автор

Good video ;) worth to add atomic transaction for db operations

Adroit
Автор

This is a great tutorial. Do you think this will work in an application that uses mulitforms?

ToddPerrodin
Автор

what about using a drop down list within a wizard so that it should be having a different next page based on the option selected on the drop down list

luckykadewere
Автор

Hello sir, my form is not getting saved, done method is not working. Please help

ExcellentSports-wk
Автор

Underated channel, clear and precise instructions. Thank you!

zackmcnelly
Автор

in my done method class
form_list = [ TimeSlotForm, DetailForm]
template_name = 'sm_appointment/index.html'


def done(self, form_list, **kwargs):
form_data = [form.cleaned_data for form in form_list]
print(form_data)
return HttpResponseRedirect('form submitted')

ExcellentSports-wk
Автор

Hello! I have difficulty saving when I use the def done(self, form_list): function

Altar-of-God
Автор

does it work with django-widget-tweaks?

juniorsemerzier
Автор

is it possible to present a single model into multi-step forms, say 3 forms for model Employee?

garidodo
Автор

Great video as always, would love to see the form preview you mentioned as well.

robhafemeister
Автор

Always enjoyed your content. Kindly do something on the complete ecosystem: Django + HTMX (for AJAX) + HyperScript (for other dynamic aspects) + TailWind

FirdausAziz
Автор

It feels like 2023 is going be a fun year with your caviar tutorial mate 🙌🏾. This is a master piece 🧩. Thank for all. Good job !

seydinaoumarsamabaly
Автор

Just curious - where's your accent from? I'm thinking Scotland, but I'm not sure if I've heard it before... 🙂

brunoaraujo
Автор

Very nice video, very helpful. Would love to see a follow-up about form preview. Thanks.

carstenthies
Автор

Excellent video as usual. Yes please to more form videos. Is it possible to have duplicate forms - lets say you have a list of goals, how would you dynamically add more goals to the wizard process? Would you create a new page for each goal or would you handle that on a single page? Probably a single page come to think of it. How would you handle that BugBytes?

grant
Автор

Hello, Great Tutorial !
especially I'm working on register wizard :
my question is how to save user object based on all form_list ?
I mean how to do something like this: user = form_list.save(commit=False)

israasalameh
Автор

nice work. For me, I'd rather stick to htmx than this. After watching your playlist on it, I'm so loving it

victorjoseph