https://htmx.org logo
Join Discord
Powered by
# 🔥-django-htmx
  • q

    quiet-action-5563

    12/01/2022, 1:38 PM
    Yes, probably, I am just using eCharts for the first time and I don't know very well
  • m

    mysterious-toddler-20573

    12/01/2022, 1:39 PM
    we could change that line to:
    Copy code
    js
      if(script.parentElement){
        script.parentElement.remove(script);
      }
  • m

    mysterious-toddler-20573

    12/01/2022, 1:39 PM
    kinda a hack, but if eCharts is gonna screw us here...
  • q

    quiet-action-5563

    12/01/2022, 1:43 PM
    Yes, this way it works; if there is no processing from HTMX after this line, I could leave the error, even if it's not very nice, what do you think ?
  • m

    mysterious-toddler-20573

    12/01/2022, 1:45 PM
    I feel like we need an try/catch around evalScript
  • m

    mysterious-toddler-20573

    12/01/2022, 1:45 PM
    as it stands, I don't think focus stuff will work 100%
  • m

    mysterious-toddler-20573

    12/01/2022, 3:06 PM
    https://github.com/bigskysoftware/htmx/commit/a96163830d98b988c421599f7fd36ca62ec7f7da
  • m

    mysterious-branch-827

    12/01/2022, 4:48 PM
    Sorry if this is not the place, but can some one point me to a thread or code base. I have been making a booking app for car-renting, I have three apps, cars, customers and the booking app which is connected to the customer and car via foreign keys. I have been trying to come to a solution when the client in the front end picks a car in the reservation form to make clickable in the datepicker only available dates via second part of the form(modal).
  • g

    green-activity-6102

    12/01/2022, 4:52 PM
    with HTMX i think the strategy would be to use
    hx-trigger="change"
    on your second form, and have it re-render your datepicker field (or probably the whole form) with the correct restrictions based on what they picked
  • r

    refined-waiter-90422

    12/03/2022, 9:10 AM
    Dang Djello looks interessstring
  • m

    miniature-controller-37356

    12/03/2022, 11:49 AM
    No Screenshots tho
  • a

    aloof-scooter-64677

    12/03/2022, 1:31 PM
    Did you write this?? There are no screenshots.
  • r

    refined-waiter-90422

    12/03/2022, 5:54 PM
    the developers prayer
  • b

    blue-ghost-19146

    12/05/2022, 9:26 AM
    Has anyone here had experience e2e integration testing a site built with django & htmx? We plan to use Playwright. Interested to hear people's experiences and words of wisdom!
  • b

    bland-answer-77576

    12/05/2022, 10:17 AM
    Since npm is advised against - I'm interested how do you include HTMX in your Django project? I'll use HTMX, Tailwind and Alpine and I would like to avoid including them in 4 different ways - I'm not sure what the best practice here would be?
  • g

    green-activity-6102

    12/05/2022, 4:08 PM
    just download the js files and host them from your STATIC_ROOT
  • m

    mammoth-family-48524

    12/05/2022, 11:16 PM
    ☝️ that’s what I do as well. I grab the files from the GitHub repos.
  • g

    green-activity-6102

    12/05/2022, 11:44 PM
    you can download them from unpkg too https://unpkg.com/browse/htmx.org@1.8.4/dist/
  • c

    crooked-winter-42525

    12/06/2022, 1:29 AM
    Anyone use HX-Target with “find ” or “closest ”? I’m getting an target error when I’m using it and wondering if I’m messing up the syntax.
  • m

    mammoth-family-48524

    12/06/2022, 9:53 AM
    I'm pretty sure I have in the past, though I've since moved everything to be on form elements. The docs mention find and closest as well, so it should work https://htmx.org/attributes/hx-target/. Want to paste the code for the requesting element and the targeted one? Maybe it's something obvious
  • b

    bland-answer-77576

    12/06/2022, 10:40 AM
    Thank you, a straightforward answer 😅
  • c

    crooked-winter-42525

    12/06/2022, 9:44 PM
    I think the issue was actually that my target was outside the element - it wasn't a parent of child element. Will have to do a regular swap and some OOB swaps I think.
  • m

    mammoth-family-48524

    12/06/2022, 9:47 PM
    Yeah that makes sense. Do you know you can put a normal css selector in there? It doesn’t have to be related to where the HTMX attributes are (find and closest aren’t mandatory)
  • c

    crooked-winter-42525

    12/06/2022, 9:49 PM
    yes, that's definitely helpful. I'm building a blackjack game and it's been interesting finding the right patterns to make HTMX work rather than just do this in pure JS. Selecting css classes is a huge help.
  • m

    mammoth-family-48524

    12/06/2022, 9:58 PM
    Nice! I’m pretty sure HTMX takes what’s in the hx-target and passes it through to querySelector functions and/or the closest ones. So whatever works with those should work with hx-target. https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
  • m

    mammoth-family-48524

    12/06/2022, 9:59 PM
    https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll
  • c

    crooked-winter-42525

    12/06/2022, 9:59 PM
    thanks for this! Going to dig a bit deeper on it tonight.
  • m

    mammoth-family-48524

    12/06/2022, 9:59 PM
    You’re welcome. Good luck!
  • m

    melodic-advantage-28381

    12/08/2022, 11:22 AM
    Actually on my side I strongly recommend npm if you plan a long life for your website or web application. Listing your external JS dependencies in a
    package.json
    enables you to easily (and even automatically if you're on Github and enable Dependabot) update/upgrade them, which is as necessary for JS deps as it is for your Python deps. For my Django projects I use npm and build a minified JS file (using esbuild) that contains all JS deps alongside with my own JS code.
  • g

    green-activity-6102

    12/08/2022, 9:05 PM
    i'll do everything i possibly can to keep
    npm
    out of my project entirely. If minifying your static assets is a priority you can also use
    django-compressor
1...858687...100Latest