Django & HTMX - Template Fragments with django-render-block

  Рет қаралды 7,695

BugBytes

BugBytes

Күн бұрын

Пікірлер: 45
@tobidegnon4409
@tobidegnon4409 2 жыл бұрын
I discovered this myself a few days ago reading htmx essay on template fragments, using it since and it really simplified my code, a great tool for any Django htmx dev
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Agreed. I've been in a position in the past where the easiest thing to do was break small parts of code into their own files, and render these in HTMX responses. Not a disaster, but the templates quickly add up. Now, this tool will prevent having to do that - very useful for HTMX and in general!
@GatewayITTutorials
@GatewayITTutorials 2 жыл бұрын
I've used a similar approach even before this article came out: 1) Create 1 html template file with all of the parts you need (for a specific page of course) 2) In the view check for HTMX header and a field name (or submit a custom header to check it in the backend) 3) Return a part of the template using the field name from the header (ie {% if header_value == "bla" %}Bla template{% endif %}) no third party extensions needed ;)
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Interesting approach, sounds good!
@sebastianolivares2899
@sebastianolivares2899 2 жыл бұрын
Hi, do you have a code example to guide us?
@GatewayITTutorials
@GatewayITTutorials 2 жыл бұрын
@@sebastianolivares2899 Post a question in my reddit forum, I'll try to put it together for you (look up the subreddit under one of my videos, I don't have it at hand, sorry)
@sebastianolivares2899
@sebastianolivares2899 2 жыл бұрын
@@GatewayITTutorials I already did
@GatewayITTutorials
@GatewayITTutorials 2 жыл бұрын
@@sebastianolivares2899 thanks, I've seen the post. Will put something together today/tomorrow
@manofhat676
@manofhat676 2 жыл бұрын
You are always providing us with the best content, Thank you.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks!
@BenMcNelly
@BenMcNelly 2 жыл бұрын
This is very timely, thanks for the heads up and great video as always!
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks a lot!
@EazyTutor
@EazyTutor Жыл бұрын
Fantastic video and to the point. Well done @bugbytes.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thank you 🙏
@michaelmabe4014
@michaelmabe4014 Жыл бұрын
Thanks for this video and the others that you have posted. I really like the way you step through whatever it is your trying to explain while keeping it at a quick pace . Worth the sub and like.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot Michael - glad the videos have been helpful! And thanks for the sub!
@repotranstech
@repotranstech 2 жыл бұрын
Good work 👍, looking forward to more Htmx staff.
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks!
@Herdogan80
@Herdogan80 2 жыл бұрын
Another great content. Thanks for sharing it. 💯
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks, glad you liked it!
@robhafemeister3100
@robhafemeister3100 2 жыл бұрын
Great video! Will definitely use with HTMX
@abrahamngetich1415
@abrahamngetich1415 2 жыл бұрын
Thanks you very much bro. Great insight on Django development. Learning HTMX with you has been
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks bro.
@paoloromolini
@paoloromolini 2 жыл бұрын
Really helpful, thanks a lot!
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thank you!
@sidds09
@sidds09 2 жыл бұрын
pls do a complete django project with alpinejs and HTMX.. it still needs to be seen if these could be used to build something big and scalable. using these in fragments is easier, but actual purpose can only be seen with some heavy work. it would be great to have something that saves us from going to react/vue, every time we build something for market.
@MagnusAnand
@MagnusAnand 2 жыл бұрын
Great video. I have a suggestion for a different topic that will help with Django topics in general: deployment 😉
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Thanks! And yeah, I'm going to be bringing some deployment stuff onto the channel soon. I've prepared content for deploying Django apps to AWS ElasticBeanstalk - I'll be recording that one soon. Any other platforms you'd be interested in seeing videos for?
@aerotow
@aerotow Ай бұрын
Thanks! Wouldn't it make sense to use the booklist view also on first load instead of passing from the main view? Feels a bit unintuitive to have to maintain it at two places and keep it consistent.
@dodokwak
@dodokwak 2 жыл бұрын
Thx. Do you think this approach will be suitable for an appointment application? Still hesitate.
@oscardonas4305
@oscardonas4305 Жыл бұрын
Thanks for the great explanation. What if I want the last book name to be visible in the input form? I mean, I would like to see the book name added in the panel below and the name also shown in the the form, just to compare that the added record is just what I typed before. Hope you can answer my question
@elpalochebas9416
@elpalochebas9416 Жыл бұрын
Hi, do you recommend for medium or Big proyects?
@cjensen2k
@cjensen2k Жыл бұрын
Do you have a repository with the completed code using the `django-render-block` package?
@robertowork7311
@robertowork7311 2 жыл бұрын
Hello friend, I wanted to thank you for the excellent videos about django and htmx. And also ask yourself, do you plan to make a video on how to integrate vite to django?
@surendrasrikakolapu7972
@surendrasrikakolapu7972 2 жыл бұрын
Is it possible for authentication (login, register) too? means template fragments...... Anyway great work !
@bugbytes3923
@bugbytes3923 2 жыл бұрын
Yes, it would definitely be possible for login and registration forms to create these fragments/blocks.
@fcutmovieproductions
@fcutmovieproductions 2 жыл бұрын
anyone. I appreciate it!!
@RellonLawrence
@RellonLawrence 2 жыл бұрын
How would you do it with CBV?
@Septumsempra8818
@Septumsempra8818 2 жыл бұрын
I'm struggling with this. I was getting a lot of recursion errors and too little help. Imma try this out, I hope it works. s/o from South Africa
@tungtung7504
@tungtung7504 2 жыл бұрын
Hopy admin build multi form post one templates…. Thanks
@ChaminduWeerasinghe
@ChaminduWeerasinghe 2 жыл бұрын
Thanks for tNice tutorials content. It was the first soft soft video I've seen that didn't assu I knew my way around all of the functions.
@slavishka7576
@slavishka7576 2 жыл бұрын
*video continues* "........you can change the tempo by clicking and DRAGGING"
@wajahatalibasharat6923
@wajahatalibasharat6923 2 жыл бұрын
LOL
@nurisafif9932
@nurisafif9932 2 жыл бұрын
I swearr
Django and HTMX #20 - 3-Level Chained Dropdowns
15:43
BugBytes
Рет қаралды 6 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
HTMX 1.9 - hx-on Attribute for Responding to Events
16:35
BugBytes
Рет қаралды 14 М.
django-htmx - Django Extensions for Working with HTMX
37:06
BugBytes
Рет қаралды 24 М.
Dynamic list views with Django and htmx
34:09
Matt Segal
Рет қаралды 15 М.
HTMX for Impatient Devs
8:33
Isaac Harris-Holt
Рет қаралды 62 М.
Django & HTMX - Dynamic Form Creation and Submission
24:36
BugBytes
Рет қаралды 31 М.
Django & HTMX - Optimistic Updates!
14:31
BugBytes
Рет қаралды 3,2 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН