Django and HTMX #13 - Chained Dropdowns using Django Forms and the django-forms-dynamic library

  Рет қаралды 12,148

BugBytes

BugBytes

Күн бұрын

Пікірлер
@FirdausAziz
@FirdausAziz 3 жыл бұрын
Hi @BugBytes, thanks for keep pumping out Django + HTMX videos. Happy New Year mate. Looking forward to seeing more in 2022.
@bugbytes3923
@bugbytes3923 3 жыл бұрын
Thank you mate! Happy new year to you too, all the best for 2022.
@silkogelman
@silkogelman 3 жыл бұрын
Wow django-forms-dynamic seems like a great library, so cool it has Htmx integration options too! Thank you for your detailed explanation BugBytes. Also very nice that you prepared this with sample data etc to get started easily. 👍👍
@bugbytes3923
@bugbytes3923 3 жыл бұрын
Thanks Sil! 😀 Yep, I like django-forms-dynamic - building the dynamic behaviour within the Form class makes sense to me. Glad you enjoyed the video!
@bicifix
@bicifix 2 жыл бұрын
Wow, I've been struggling making a complex form with many internal dependencies, and this video was exactly what I needed. Thanks.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thank you! I'm glad it has helped :)
@andrewwarner3969
@andrewwarner3969 2 жыл бұрын
Thank you for this! Definitely going to send a coffee your way. Is there a way to add a third tier to the select, based on the 2nd select. eg. 1st select > 2nd select > 3rd select? Really appreciate any help on this.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
I've been meaning to add a video on this. Going to prepare it soon, hopefully! And thank you very much!
@andrewwarner3969
@andrewwarner3969 2 жыл бұрын
@@bugbytes3923 ahh perfect thank you! I tried to replicate again what you showed in your video but it just broke the initial select.
@Christian-qy7lg
@Christian-qy7lg Жыл бұрын
@@andrewwarner3969 Has anyone already managed to do this with the third select? The first two work perfectly for me, but the third does not work according to the same scheme. Thanks a lot!
@andrewwarner3969
@andrewwarner3969 Жыл бұрын
@@Christian-qy7lg hey. Yeah, BugBytes created a video on the approach kzbin.info/www/bejne/eKnbdYSFpMSlhKs
@Said664016
@Said664016 Жыл бұрын
@@Christian-qy7lg I am also curious how to do third select only with form. There is a video about 3-Level Chained Dropdowns, but that one works on models. Hope to manage with that. Thanks!
@seydinaoumarsamabaly1806
@seydinaoumarsamabaly1806 3 жыл бұрын
You really are a source of inspiration ! Since I started following you I'm always amazed by your contents ! Big respect mate. Happy New Year 2022. GOD bless you
@bugbytes3923
@bugbytes3923 3 жыл бұрын
Thank you very much man! :)
@fernandtape9363
@fernandtape9363 3 жыл бұрын
Another nice video. Thank you to make us discover this library.
@bugbytes3923
@bugbytes3923 3 жыл бұрын
Thank you!
@nishasingh3097
@nishasingh3097 Жыл бұрын
Thanks a lot ! It is a huge help
@TravisPickle
@TravisPickle 3 жыл бұрын
awesome job, thanks
@bugbytes3923
@bugbytes3923 3 жыл бұрын
Thank you!
@Zeksait
@Zeksait 11 ай бұрын
In a view, I cannot custom write values to initial, since the form is rendered and calls the replacement functions. help me please
@Zeksait
@Zeksait 11 ай бұрын
I forgot to change the queryset in views.py form.fields['client'].queryset = ... =)
@aicreativetools
@aicreativetools 11 ай бұрын
Hi @BugBytes, how can i use with model form with Select Field ?
@weholt
@weholt 2 жыл бұрын
I love your videos :-) Do you know if there's a way to avoid hardcoding paths in the code, like in the part where hx-get is fetching the modules part, but using a hardcoded path /modules/ instead of {% url 'modules' %}?
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks Thomas! :) If you are adding hx-get to the raw HTML element, you can use the {% url 'modules' %} template tag (I think I did this in the previous video). I had to change it to hard-code the URL in this video - I'm not sure how to use the url template-tag within the {% render_field %} expression - if anybody has any ideas on this, it'd be good to get a solution. I didn't want to hard-code the path, but couldn't find an alternative unfortunately!
@Famelhaut
@Famelhaut 9 ай бұрын
@@bugbytes3923 You need to use with, like so: {% url 'settings' var1 var2 as action_url %} {% include "default_form.html" with action=action_url %}
@edwardkim1539
@edwardkim1539 2 жыл бұрын
Thanks for great tutorials. I was able to generate chained dropdowns with a HTMX to add but getting an error when updating: BaseForm.__init__() got an unexpected keyword argument 'instance'. Can you show us how to update using django-forms-dynamic.
@LewisFletcher981
@LewisFletcher981 2 жыл бұрын
Hey @BugBytes, awesome and helpful video. When I attempt to save the form to my database, it says it is missing that attribute and it seems the dynamic field cant't be saved. Any chance you have a solution for this? Thanks!
@jorgeav527-xyz
@jorgeav527-xyz 2 жыл бұрын
how can I achieve this {% for u in formset.forms %} {% render_field u.name hx-target="name-{{forloop.counter0}}" %} {% endfor %}
@gliffuct
@gliffuct Жыл бұрын
Cheers buddy helped a lot thank you. Any tips for adding third or fourth layers?
@pedrokapingala4411
@pedrokapingala4411 2 жыл бұрын
Nice video and thanks very much. could you make a another video but using dropdown list with the forms to add data in the table. that one you are using the view.....
@jodikurniawan3732
@jodikurniawan3732 11 ай бұрын
how to save data using modelform
@Zeksait
@Zeksait 11 ай бұрын
this doesn't work if you use two more child fields as well. I'm still learning how to do it
@Zeksait
@Zeksait 11 ай бұрын
I had to wrap several fields in divs and replace this html block as one whole. This is how it works
@matiassalas4470
@matiassalas4470 2 жыл бұрын
I have this error... DynamicField.__init__() missing 1 required positional argument: 'field_class' Can Somebody helps me plz !
@matiassalas4470
@matiassalas4470 2 жыл бұрын
Somebody has this code ??
@ioannp.5274
@ioannp.5274 11 ай бұрын
django-autocomplete-light still looks as more easier and effective way to achieve the same in Django
@janedoe1673
@janedoe1673 2 жыл бұрын
If anyone having trouble making this work even though you followed every step thoroughly, that might be becuase you havent included a script tag for htmx to work. Your welcome!!!
@bbrendon
@bbrendon Жыл бұрын
Dynamic Django Forms isn't maintained so probably not a good idea to use it.
@Famelhaut
@Famelhaut 9 ай бұрын
There are 2 packages, dynamic-django-forms and django-forms-dynamic. The package used in the video is django-forms-dynamic, which is maintained and even if it wasn't it's like 10 lines of code. Try the link in the description.
Django & HTMX - Dynamic Form Creation and Submission
24:36
BugBytes
Рет қаралды 31 М.
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Create a Dependent Select Field in Django With HTMX
14:37
Pretty Printed
Рет қаралды 19 М.
Django and HTMX #10 - Chained Dropdowns with Django and HTMX
12:27
Dynamic list views with Django and htmx
34:09
Matt Segal
Рет қаралды 15 М.
Django, HTMX and Alpine.js - Modals and Forms
23:07
BugBytes
Рет қаралды 14 М.
Django and HTMX #5 - Building a Dynamic Search Component
20:32