Тёмный

Building Django forms with django-crispy-forms 

BugBytes
Подписаться 28 тыс.
Просмотров 44 тыс.
50% 1

In this video, we'll look at django-crispy-forms - a package for building out forms in your Django code that look better and are highly customizable.
We'll refactor a simple Django Form class to use django-crispy-forms, and will customize the form's widgets and appearance. We will also demonstrate how to add HTMX attributes to a form field within the Form class itself, rather than in the template.
Starter code can be found in the Github repository:
github.com/bugbytes-io/crispy...
▶️ Full Playlist:
• Django-crispy-forms & ...
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:58 Creating Django form
03:05 Refactoring with django-crispy-forms
04:50 Changing form field widgets
07:05 Adding crispy-forms FormHelper
10:11 Adding HTMX attributes to form field
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugbytes
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: www.bugbytes.io/posts/
👾 Github: github.com/bugbytes-io/crispy...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
django-crispy-forms: django-crispy-forms.readthedo...
#django #python

Опубликовано:

 

21 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 61   
@NicolaMastrandrea
@NicolaMastrandrea 2 года назад
I'll be honest, I have seen too many Django tutorials but you are the only one who can actually go straight to the point in the most clear way possible.
@bugbytes3923
@bugbytes3923 2 года назад
AWesome, thanks a lot for that comment Nicola!
@NicolaMastrandrea
@NicolaMastrandrea 2 года назад
@@bugbytes3923
@FredSq
@FredSq 6 месяцев назад
the way you are demonstrating things is incredible❤
@bugbytes3923
@bugbytes3923 6 месяцев назад
Thanks a lot for the nice comment!
@TheDarrenJones
@TheDarrenJones 2 года назад
Structured, Well presented and at just the right pace, as all your videos are. I've used crispy forms before, but still learned things (and better ways to do what I was doing as well). Thanks.
@bugbytes3923
@bugbytes3923 2 года назад
Thanks Darren, that's very good to hear that! Cheers!
@rickavmanaic
@rickavmanaic 2 года назад
Great video. I follow you for a while now and want to say you are getting better . Keep the good work.
@bugbytes3923
@bugbytes3923 2 года назад
Thanks Eric, I appreciate that comment!
@viniciusstucki
@viniciusstucki 2 года назад
Nice content! Excelent video! Greetings from Brazil!
@bugbytes3923
@bugbytes3923 2 года назад
Thank you! Nice one, I'm hoping to visit Brazil someday! Glad to hear you like the video.
@OwaisAkber
@OwaisAkber Год назад
amazin video and amazin tools introduced just is such short video. superb and big thanks
@bugbytes3923
@bugbytes3923 Год назад
Thank you for watching - glad you enjoyed it!
@seydinaoumarsamabaly1806
@seydinaoumarsamabaly1806 2 года назад
Hello Master 🙌🏾🙌🏾🙌🏾, i think you're reading in people's mind 🤔. I really was in need of how to do htmx with crispy forms and abracadabra 🪄 you did it 😌. GOD BLESS MATE. YOU ARE GREAT MAN 🙌🏾.
@bugbytes3923
@bugbytes3923 2 года назад
Thanks man! Well, I wish I could read people's minds 😂 But I'm glad the videos are useful for you! Cheers!
@Zeksait
@Zeksait 11 месяцев назад
Big Thanks! Very simple lecture
@bugbytes3923
@bugbytes3923 11 месяцев назад
Thanks for watching!
@naumanarif21
@naumanarif21 2 года назад
Great Video Mate!
@bugbytes3923
@bugbytes3923 2 года назад
Thank you mate!
@JT-mr3db
@JT-mr3db 8 месяцев назад
Using crispy as is really works great, especially if all you want are the bootstrap classes. If you decide to venture in to the custom template pack world, you really see first hand how much complexity it is hiding you from you.
@anatolys9203
@anatolys9203 2 года назад
that's great! thank you!
@bugbytes3923
@bugbytes3923 2 года назад
Thank you!
@coder.come123
@coder.come123 8 месяцев назад
Good Bless you . ❤👌
@mrmuranga
@mrmuranga Год назад
awesome thanks😅
@ilyawhitee
@ilyawhitee Год назад
Your accent is lovely mate
@aguywithoutaname
@aguywithoutaname 2 года назад
No amount of django crispy forms can render any website as 'crespy' as your accent. wow😁
@bugbytes3923
@bugbytes3923 2 года назад
Wow, thank you!!
@kapitankidlattv9613
@kapitankidlattv9613 Год назад
I can't seem to make the Inline radio select :( do you have any idea how to implement this?
@abdoulazizba9248
@abdoulazizba9248 2 года назад
Nice video
@bugbytes3923
@bugbytes3923 2 года назад
Thanks!
@watsoncyrusanikwai3888
@watsoncyrusanikwai3888 Год назад
How do you go about model forms?
@WarhelmeTR
@WarhelmeTR 11 месяцев назад
Widgets working perfect thank you. But after used widget verbose_name changed, how can I setup verbose_name correctly, any help?
@isaacsamuel1689
@isaacsamuel1689 Год назад
Thank you very much this solved my problem. But could you point me to a video that explains Modal Popup, I will really appreciate
@gongjiaji2489
@gongjiaji2489 2 года назад
no trash talk, good.
@bugbytes3923
@bugbytes3923 2 года назад
thanks!
@elhalmihamza28
@elhalmihamza28 Год назад
how I get `dd/mm/yyyy` date format in form ?
@aalaptube
@aalaptube 2 месяца назад
I started off with BootStrap5, hands me over a lot of control in the template. Just read Crispy docs, and it seems nice. But the question I am askimg to myself is: do I want to build the whole html in the view instead of template? I am not sure at this point.
@bugbytes3923
@bugbytes3923 2 месяца назад
If you prefer to build in the template (as I generally do), you can use django-widget-tweaks alongside Django form fields to add Bootstrap classes to the fields.
@nicenaija9952
@nicenaija9952 2 года назад
Do a Django allauth video. With multiple user type registration say, register as Teacher or Student. And how you can restrict views using decorators functions for them. Thank youuu
@bugbytes3923
@bugbytes3923 2 года назад
That's a great suggestion, thanks! I'll definitely look into doing an allauth video in the next month or so. Thanks again!
@samucancld
@samucancld 2 года назад
muy bueno loko
@elhalmihamza28
@elhalmihamza28 Год назад
hallo BugBytes beautiful video
@bugbytes3923
@bugbytes3923 Год назад
Thank you 😄
@user-qw5nm2rw3e
@user-qw5nm2rw3e 7 месяцев назад
How do we style it if we require a little bit of customisation or if we require another framework like Tailwind? This strategy has drawbacks, in my opinion. Since I'm a student, my expertise is limited.
@stivunnikolov5941
@stivunnikolov5941 2 года назад
Great video. You have new subscriber here!! One question.....how is it going to work if I need to pass pk to my reverse_lazy function? (I'm really new to Django and web dev.) Thank in advance!!
@bugbytes3923
@bugbytes3923 2 года назад
Thank you. You can pass kwargs to the reverse_lazy function, so for example you can pass the primary key. Something like this: reverse_lazy('my-url', kwargs={'pk': 1})
@stivunnikolov5941
@stivunnikolov5941 2 года назад
I kinda fixed the problem. I use CBV and I use success url and get_success_url so i don't need to specify it in the form. Thanks for the answer!
@stivunnikolov5941
@stivunnikolov5941 2 года назад
Another question that i cant find solution in google is how to change the labels font size from the crispy forms? or to simply do it via CSS
@masterloquendo0
@masterloquendo0 2 года назад
this video contains steps that i couldn't follow quite well, is this by chance a Part 2 video? i didn't see you creating the forms.py file and index.html and base.html
@bugbytes3923
@bugbytes3923 2 года назад
The starter code can be found in this Git repo: github.com/bugbytes-io/crispy-forms-htmx (you can work from the Starter code directory - create the forms.py file and follow along with the video) Thanks for letting me know - I've added that link to the video description, too.
@masterloquendo0
@masterloquendo0 2 года назад
@@bugbytes3923 you're welcome bud, thanks for the answer
@ec_789
@ec_789 Год назад
How to add a variable running javascript code and its value as an attribute to a django form field.
@jestinmathew2031
@jestinmathew2031 Год назад
Hey man, awesome explanation. Can i know how can I contact you i have a project at my work that has some complex crispy form usage so need your help there
@bugbytes3923
@bugbytes3923 Год назад
Thanks. Feel free to email: www.bugbytes.io/contact/
@ashokkmr8758
@ashokkmr8758 8 месяцев назад
I'm new to Django, i was confused , i forgot to add bootstrap CSS , script links in base file😆
@nicenaija9952
@nicenaija9952 2 года назад
I love youuuu
@crishl19
@crishl19 Год назад
some help ! I do not how to fix this: ModuleNotFoundError: No module named ‘crispy_forms’
@bugbytes3923
@bugbytes3923 Год назад
Hey. You have not installed crispy forms in your environment, try these commands: pip install django-crispy-forms And then add crispy_forms to your installed apps
@crishl19
@crishl19 Год назад
@@bugbytes3923 hi ! i have to create a new virtual enviroment. now works
@user-qw5nm2rw3e
@user-qw5nm2rw3e 7 месяцев назад
How do we style it if we require a little bit of customisation or if we require another framework like Tailwind? This strategy has drawbacks, in my opinion. Since I'm a student, my expertise is limited.
Далее
Django & HTMX - Dynamic Form Creation and Submission
24:36
skibidi toilet 76 (full episode)
08:11
Просмотров 10 млн
Django Dynamic Forms Tutorial with Htmx
48:27
Просмотров 66 тыс.
Style Django Forms With Bootstrap - Django Blog #5
15:46
Modal forms with Django+HTMX
54:21
Просмотров 33 тыс.