django-htmx - Django Extensions for Working with HTMX

Поделиться
HTML-код
  • Опубликовано: 29 окт 2024

Комментарии • 97

  • @立法院很忙
    @立法院很忙 Год назад +20

    Always happy to see Django + HTMX content. Thanks!

  • @gulledhaydar
    @gulledhaydar Год назад +10

    This is actually the first HTMX video I've watched from beginning to end. Why? Because it demonstrated real-world issues. Thanks all the way from Somalia!

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks a lot for watching, and greetings from Scotland!

  • @gichukimike
    @gichukimike Год назад +2

    Thank you for the tutorials, I had not looked into that Django-htmx that deeply. Thank you for simplifying for us. Your tutorial has made my current project awesome

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks Michael - great to hear that, I’m glad it’s helped!

  • @vivaldi-qo7xj
    @vivaldi-qo7xj Год назад +1

    I watch all videos with django and htmx very carefully. Thanks.

  • @dymastro788
    @dymastro788 Год назад +5

    Thanks again for the HTMX content! Looking forward to course. Also thanks for explaining all the small steps you do in your video. Really helpfull.

    • @bugbytes3923
      @bugbytes3923  Год назад +2

      Thanks - glad the explanations are useful! Will hopefully start recording the course in the next few weeks.

    • @dymastro788
      @dymastro788 Год назад

      @@bugbytes3923 Cool thanks for the effort. Question: Are you planning a video with HTMX + Leaflet? :)

  • @GavinElie
    @GavinElie Год назад +1

    Your videos are always very clear and concise. Thank you for these very useful tutorials.

  • @sovfren
    @sovfren Год назад +2

    Im so glad I found your channel. Im an aspiring django developer and ive made some static pages however I was dreading taking on JavaScript and discovered HTMX. Your content is precise and has already got me going. Thanks all the way from Sunderland 😁

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks a lot! Glad it’s helping, and greetings from Glasgow 😄

  • @ChrisPatti
    @ChrisPatti Год назад +3

    I really enjoyed this video. Thank you for making it! It’s an excellent romp through some of the possibilities, HTMX and Django offer.

  • @Bartburger02
    @Bartburger02 Год назад +1

    Thank you again for making me aware of another useful library and providing an informative introduction 🎉

    • @bugbytes3923
      @bugbytes3923  Год назад

      You’re welcome, thanks a lot for viewing!

  • @AmoahDevLabs
    @AmoahDevLabs Год назад +1

    This library maintained by Adams Chainz is quiet interesting. Thanks for showing the in-depths of django-htmx.

  • @МаксимБалашов-м3г
    @МаксимБалашов-м3г Год назад +3

    HTMХ again! This is wonderful! Thanks for the videos!

    • @bugbytes3923
      @bugbytes3923  Год назад

      You're welcome, thanks a lot for the view!

  • @banka990
    @banka990 Год назад +1

    Thank you for the content you produce. And thank you for the Scottish accent! 😀 I was supposed to move to Scotland recently but some unfortunate events stopped me, so this will help ease the pain. I'm in the beginning of my Django learning journey, so I will definitely come to your videos many times. Good luck!

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thank you very much - glad you like the content (and accent) 😄Sorry to hear the move to Scotland didn't work out. If you have any requests for content, feel free to let me know, and good luck!

    • @banka990
      @banka990 Год назад +1

      @@bugbytes3923 GeoDjango is something I'm interested in. It's still too early for me to jump right there, but hopefully in the future I can use your videos to get familiar with it. Thanks!

  • @CristianMolina
    @CristianMolina 11 месяцев назад

    Love it, thanks for sharing about htmx. I'm new to Django but long time Rails dev and it's nice to see this htmx nice companion package.

    • @bugbytes3923
      @bugbytes3923  11 месяцев назад

      Thanks a lot! Great thing about HTMX is that it works well with anything, so these examples translate easily to Rails and other frameworks!

  • @bitemouth
    @bitemouth 9 месяцев назад

    Thanks for the video. Please don’t skip frames of copy paste and editing... it becomes more easy to follow and understand... thanks again for the video🎉

  • @seydinaoumarsamabaly1806
    @seydinaoumarsamabaly1806 Год назад +1

    What more can I say other than thank you Master for everything you do. A real treat your tutorials 😌

  • @martincronje5242
    @martincronje5242 3 месяца назад

    As always a good systematic explanation.

  • @iloveloam276
    @iloveloam276 Год назад +1

    This is awesome dude. I'm learning HTMX/Hyperscript and it's a massive help to be able to reference your videos along with the documentation, especially as i'm more of a Django person than a Javascript wizard!

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks a lot! Glad they have helped - and yeah, I think a lot of us would prefer to do the lifting in Django rather than JavaScript 😄

    • @iloveloam276
      @iloveloam276 Год назад

      @@bugbytes3923 haha In my learning I went from Python (yay), Django (yay), JS....wtf is this! ;) HTMX/Hyperscript, is actually making me look at a lot more JS but it's hard when you are as used to Python.

  • @AliHassan-wc6nb
    @AliHassan-wc6nb Год назад

    This guy is another champ! Very academy, code holic, django Mastery, codewithstein, and bugbytes!!
    But for htmx! One and only bugbytes.

    • @bugbytes3923
      @bugbytes3923  Год назад

      Haha thanks a lot! Some great channels there.

  • @keenoogodlike
    @keenoogodlike 10 месяцев назад +2

    I love HTMX already, great content!!!

  • @WebDevTrailblazer
    @WebDevTrailblazer Год назад +1

    Great work 👍

  • @jgibs1
    @jgibs1 Год назад +1

    Truly helpful videos. Thank you for the time you put into them.

  • @IqbalArain-io3du
    @IqbalArain-io3du 6 месяцев назад

    You explained really really well. Thank you soooooo much ❤

    • @bugbytes3923
      @bugbytes3923  6 месяцев назад

      Thanks a lot, much appreciated!

  • @JustinSpryce
    @JustinSpryce Год назад +1

    Thank you sir, for the htmx lesson

    • @bugbytes3923
      @bugbytes3923  Год назад

      You're welcome, thanks for watching Justin!

  •  Год назад +1

    Good morning from Argentina 😊

  • @repotranstech
    @repotranstech Год назад +1

    Cool video as always 👍

  • @ec_789
    @ec_789 Год назад +1

    You're great, thanks,

  • @sudoscientist255
    @sudoscientist255 Год назад

    Quick question, I've been using htmx in django without django_htmx and one of my views (submitting a form for an arbitrary content block model instance on the given page through a modal), when the form is valid, returns a simple HttpResponse with an 'HX-Trigger' parameter set to a custom htmx event I have configured on the client side. I am now wanting to use django_htmx to reduce my htmx-related configuration and hacks but am wondering regarding 'trigger_client_event', if I were to return a trigger_client_event with the response mentioned (having 'HX-Trigger'), would both events be fired or would the former one be overridden?

  • @genesisguerrero7151
    @genesisguerrero7151 Год назад

    Great summary!

  • @TomislavMiletic
    @TomislavMiletic Год назад +1

    Thank you very much

  • @kennyPAGC
    @kennyPAGC 6 месяцев назад

    Regarding the http response location, I really dislike using the target option on the view because of the coupling it creates between the backend and the frontend. Is there an alternative to control directly in the frontend where to load the response?

  • @sudoscientist255
    @sudoscientist255 Год назад

    You're my favorite channel for modern django and tooling for it. I've been getting into htmx and hyperscript a lot. Would you please make a video on the htmx extension 'client-side-templates' with django for more dynamically templating partial endpoints (specifically api-like endpoints just returning data)? A couple months ago I'd been learning XSLT and XSD (XML) with ideas of using it with XHTML in django projects. It seems like overkill using it though just to template incoming data from an api endpoint yet this htmx extension seems like a much better fit. I'm also interested in where to put the mustache/handlebars templates if doing this (in static or templates?) as well as the ease of integration and compared performance to the normal template partials. Keep up the content! Always enjoy it, especially the django stuff with an extra bonus for all django + htmx topics

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks a lot! I'll have a look into your suggestion!

  • @Yarkanlaki
    @Yarkanlaki Год назад

    🎉 i had headaches with htmx cuz it swapped same element in every htmx request

  • @LegionLeague
    @LegionLeague Год назад

    That's an easy like from me.
    Quick question. Around 10-minute mark. What method should I overload in class-based views for `if request.htmx` part? Is it `def get`?

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks a lot!
      Yes, for this example, you can overload the get() method. If you're using a FormView, it could be done in the form_valid() method too.

    • @LegionLeague
      @LegionLeague Год назад

      @@bugbytes3923 great, thank you! As a general feedback, it would be very useful if you could at least verbally mention the implementation in the class based views for those of us who prefer it :) what you wrote in this reply is absolutely enough. Looking forward to your next videos!

  • @hamzabawumia
    @hamzabawumia 5 месяцев назад

    How do you handle server errors like 500, 501 or 404 errors. During development, it is useful to see the actual django error in the browser rather than seeing it in the browser console.

  • @alcizonthebeatofficial6066
    @alcizonthebeatofficial6066 Год назад

    Thanks for the video.
    But i have some questions, why is my local (src="js/htmx.min.js" ) not working, but the remote "src="http.........htmx....." is working ?

    • @bugbytes3923
      @bugbytes3923  Год назад

      I would guess your local path is incorrect - check the browser developer tools to see if you're getting any messages!

  • @Septumsempra8818
    @Septumsempra8818 Год назад

    Anyone had hx-push problems with HTMX? I have a navbar with onclick animations. Whenever I use hx-push in my hx-get request, I lose the navbar animations. Only after a hard refresh does it all come back.

  • @keyton_weissinger
    @keyton_weissinger Год назад +1

    Great video. You mentioned that in prod you’d not use CDN to pull in htmx. Why not and what would you do instead?

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks Keyton. You're better to serve the static content such as vendor libraries (HTMX, Alpine, etc) directly from the server, rather than from a CDN. Good article on why here:
      blog.wesleyac.com/posts/why-not-javascript-cdn
      On prod, you have a few options:
      1. Download the HTMX source code directly to your repository, and serve it from the static root. You could, for example, just copy the source code from the CDN to a local file called 'htmx.min.js' and add that file to your static resources in the Django project.
      2. Use NPM and a tool like Webpack or Vite, and manage your JavaScript resources through this bundler tool. Better to do this if you're using a lot of external JavaScript libraries, perhaps.
      Maybe this should be a video :D

    • @keyton_weissinger
      @keyton_weissinger Год назад

      @@bugbytes3923 Fantastic. THank you for the answer AND the link to WHY. Awesome!

  • @abbaskareem5281
    @abbaskareem5281 Год назад +2

    Last day someone on reddit was asking for best channels on youtube for django and htmx and everyone agree that BugBytes is the best ever !!!... thank you very much sir your content is very helpful and we use it a lot as a guide and best practice when using django and htmx .. I have a big project with djangorestframework as an api and react on frontend and I am rethinking of built it with django-htmx..
    One question please, if we use hx_push_url it's only change the url I can't use for example to add active class base on url {% if request.path == 'aboutPage' %} bg-gray-600 text-green-400 {% endif %} .. what is the work around of this ?

    • @bugbytes3923
      @bugbytes3923  Год назад

      I didn't know that - nice to hear, thank you!
      I'm not sure about your problem there - you may need to write some custom JavaScript for this, perhaps - to check the current URL and add a class dynamically when the response is received. Will think about it and get back to you.

  • @unknown-fd1yz
    @unknown-fd1yz Год назад

    Hey really nice video
    About htmx, it seems like code readability and maintenance wise it would be a disaster since now (perceived) client side and server side is a lot more dependent on each other.
    So you cannot guess what the client side is doing without checking other partial templates.

    • @bugbytes3923
      @bugbytes3923  Год назад

      I agree with those points, to an extent. HTMX can simplify a lot of the development/deployment process, and is a great tool for developers who aren't necessary front-end engineers - but at some point with a large app, it may be difficult to maintain.
      The trade-off between the two approaches is interesting to me, but I still don't fully know my own opinion on it all :D

  • @frameff9073
    @frameff9073 Год назад +1

    thank

  • @nson22
    @nson22 Год назад

    A positive side of using HTMX for QA testing it because refer to ID attribute

  • @Peterstavrou
    @Peterstavrou Год назад +1

    Love it!
    Is the only purpose of "boost" to send a boolean in a htmx request? Also, do you recommend using retarget as a general rule of thumb vs hx-target within the html or is it just a personal preference?

  • @codevalley9511
    @codevalley9511 Год назад

    Thanks brother,
    Make a video in which django views send the dictionary and we want render only some keys on ul
    And one e commerce using htmx

  • @zackmcnelly
    @zackmcnelly Год назад

    Looking for methods to track page views. I have seen Django hitcount etc. But it requires the user is logged in and session data I believe. I wonder if there is a HTMX method. Great video as always! Thanks

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks! Interesting suggestion, I'm not aware of any HTMX-based solutions at the moment, but will look into it.

    • @zackmcnelly
      @zackmcnelly Год назад

      @@bugbytes3923 Thanks!

  • @DwayneLofton
    @DwayneLofton Год назад +1

    Is there something similar for flask?

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      There’s a package that’s similar for Flask, yes:
      github.com/edmondchuc/flask-htmx

    • @DwayneLofton
      @DwayneLofton Год назад +1

      @@bugbytes3923 awesome! hope you do a video soon!

  • @pss_crs
    @pss_crs Год назад

    please do alot of HTMLx and golang

  • @amjadalikhan1194
    @amjadalikhan1194 Год назад

    Hi Please make video on localization how to work multi languages or bilanguages

  • @Schlumpfpirat
    @Schlumpfpirat Год назад

    But why use retarget if you can just swatch OOB 🤔

    • @bugbytes3923
      @bugbytes3923  Год назад

      I think this comes down to preference. Two ways to achieve the same thing, essentially.
      OOB swaps are a little bit harder to reason about, in my opinion. Nothing wrong with them, but if I have django-htmx in my app, I'd probably opt for using the retarget() function.

    • @Schlumpfpirat
      @Schlumpfpirat Год назад +2

      @@bugbytes3923 In my opinion refering HTML IDs within your Django code, couples the both interfaces a bit too tightly. Keeping frontend logic to the frontend makes maintenance easier and the overall architecture less complex.

    • @bugbytes3923
      @bugbytes3923  Год назад

      @@Schlumpfpirat That's a very good point on the other side of the argument, definitely!