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

Поділитися
Вставка
  • Опубліковано 6 жов 2024

КОМЕНТАРІ • 46

  • @tobidegnon4409
    @tobidegnon4409 2 роки тому +5

    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 роки тому +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 роки тому +5

    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 Рік тому

      Hi, do you have a code example to guide us?

    • @GatewayITTutorials
      @GatewayITTutorials Рік тому +1

      @@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 Рік тому

      @@GatewayITTutorials I already did

    • @GatewayITTutorials
      @GatewayITTutorials Рік тому +1

      @@sebastianolivares2899 thanks, I've seen the post. Will put something together today/tomorrow

  • @sidds09
    @sidds09 2 роки тому +1

    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.

  • @manofhat676
    @manofhat676 2 роки тому +2

    You are always providing us with the best content, Thank you.

  • @BenMcNelly
    @BenMcNelly 2 роки тому +1

    This is very timely, thanks for the heads up and great video as always!

  • @michaelmabe4014
    @michaelmabe4014 Рік тому +1

    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!

  • @repotranstech9614
    @repotranstech9614 2 роки тому +2

    Good work 👍, looking forward to more Htmx staff.

  • @EazyTutor
    @EazyTutor Рік тому +1

    Fantastic video and to the point. Well done @bugbytes.

  • @abrahamngetich1415
    @abrahamngetich1415 2 роки тому

    Thanks you very much bro. Great insight on Django development. Learning HTMX with you has been

  • @MagnusAnand
    @MagnusAnand 2 роки тому +1

    Great video. I have a suggestion for a different topic that will help with Django topics in general: deployment 😉

    • @bugbytes3923
      @bugbytes3923  2 роки тому +1

      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?

  • @robhafemeister3100
    @robhafemeister3100 2 роки тому +1

    Great video! Will definitely use with HTMX

  • @WaqarKhan-zf3ef
    @WaqarKhan-zf3ef 2 роки тому +2

    Love you video bro thank you for sharing new Django packages

  • @Herdogan80
    @Herdogan80 Рік тому +1

    Another great content. Thanks for sharing it. 💯

  • @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 роки тому +1

    Is it possible for authentication (login, register) too?
    means template fragments......
    Anyway great work !

    • @bugbytes3923
      @bugbytes3923  2 роки тому +1

      Yes, it would definitely be possible for login and registration forms to create these fragments/blocks.

  • @paoloromolini
    @paoloromolini 2 роки тому +1

    Really helpful, thanks a lot!

  • @oscardonas4305
    @oscardonas4305 9 місяців тому

    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

  • @dodokwak
    @dodokwak 2 роки тому

    Thx. Do you think this approach will be suitable for an appointment application? Still hesitate.

  • @Septumsempra8818
    @Septumsempra8818 Рік тому

    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

  • @elpalochebas9416
    @elpalochebas9416 Рік тому

    Hi, do you recommend for medium or Big proyects?

  • @cjensen2k
    @cjensen2k 11 місяців тому

    Do you have a repository with the completed code using the `django-render-block` package?

  • @tungtung7504
    @tungtung7504 2 роки тому

    Hopy admin build multi form post one templates…. Thanks

  • @fcutmovieproductions
    @fcutmovieproductions 2 роки тому

    anyone. I appreciate it!!

  • @ChaminduWeerasinghe
    @ChaminduWeerasinghe 2 роки тому +1

    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.

  • @RellonLawrence
    @RellonLawrence 2 роки тому

    How would you do it with CBV?

  • @slavishka7576
    @slavishka7576 2 роки тому

    *video continues* "........you can change the tempo by clicking and DRAGGING"

  • @wajahatalibasharat6923
    @wajahatalibasharat6923 2 роки тому +1

    LOL

  • @nurisafif9932
    @nurisafif9932 2 роки тому

    I swearr