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

    ancient-rose-1570

    02/01/2022, 10:07 AM
    ok, thank you
  • b

    bland-coat-6833

    02/01/2022, 10:12 AM
    You could probably sprinkle in some hyperscript there instead
    Copy code
    html
    <div hx-get="{% url "deals:deal-create" listing.slug %}" 
         hx-trigger="load"    
         id="htmx-ref"
         _="on htmx:responseError
            set my innerHtml to 'Some error happened 😱'
           "
    >
      {% include "includes/loading.html" %}
    </div>
    That'll keep all the logic local.
  • w

    white-motorcycle-95262

    02/01/2022, 3:58 PM
    I did some searching around the discord, but still have questions: anyone successfully set up django-cors to work with HTMX? Based on some old threads here, it seems like I might want to add
    hx-trigger
    to
    CORS_ALLOW_HEADERS
    in settings.. Anyone have any experience with this? EDIT: Looks like you need to add all 8 HTMX request headers to CORS_ALLOW_HEADERS. I used the following in my settings
    Copy code
    from corsheaders.defaults import default_headers
    
    CORS_ALLOW_HEADERS = list(default_headers) + [
      'hx-boosted',
      'hx-current-url',
      'hx-history-restore-request',
      'hx-prompt',
      'hx-request',
      'hx-target',
      'hx-trigger-name',
      'hx-trigger',
    ]
  • w

    white-motorcycle-95262

    02/01/2022, 3:59 PM
    lol just realized that @User also created django-cors-headers
  • q

    quaint-football-59260

    02/02/2022, 2:21 PM
    hi guys, is it possible with htmx to submit all forms with one button like in the form set?
  • h

    hundreds-camera-24900

    02/02/2022, 3:40 PM
    a formset is really just one form element
  • h

    hundreds-camera-24900

    02/02/2022, 3:40 PM
    so you're still submitting a single form
  • h

    hundreds-camera-24900

    02/02/2022, 3:40 PM
    which htmx can do
  • m

    mysterious-toddler-20573

    02/02/2022, 5:08 PM
    just put the
    hx-post
    on the form in question
  • a

    acoustic-lawyer-26558

    02/05/2022, 3:12 AM
    what would you folks do if you needed to add a multi select autocomplete? it would be sourced from my own api endpoint on my own database ... i use one currently with SemanticUI which is really nice, but i'm dropping Semantic in my projects
  • h

    hundreds-camera-24900

    02/05/2022, 3:24 AM
    I like tom-select
  • a

    acoustic-lawyer-26558

    02/05/2022, 3:28 AM
    hilarious name. hah, this is also for a celebrity project so ironic. i'll check in to it!
  • h

    hundreds-camera-24900

    02/05/2022, 3:38 AM
    https://tom-select.js.org/
  • h

    hundreds-camera-24900

    02/05/2022, 3:40 AM
    if you want something a little more crunchy - https://alpinejs.dev/pattern/dropdown
  • a

    acoustic-lawyer-26558

    02/05/2022, 3:40 AM
    tom select looks absolutely perfect for what i need!
  • a

    acoustic-lawyer-26558

    02/05/2022, 3:42 AM
    will definitely look at aplinejs too, i don't know anything about alpine
  • h

    hundreds-camera-24900

    02/05/2022, 3:42 AM
    alpine is a very small feature set for a javascript library
  • h

    hundreds-camera-24900

    02/05/2022, 3:43 AM
    the components he's been making youtubes for are great because it starts from nothing
  • h

    hundreds-camera-24900

    02/05/2022, 3:43 AM
    so even if you don't use the the library watching the video is worth it because he just talks about a lot of little details that are worth knowing
  • m

    mammoth-family-48524

    02/05/2022, 8:48 PM
    I use a web component library called https://shoelace.style/components/select that is great
  • m

    melodic-parrot-20305

    02/06/2022, 3:12 PM
    Hey Guys quick question?
  • m

    melodic-parrot-20305

    02/06/2022, 3:12 PM
    Can we do two way data binding with HTMX
  • b

    bland-coat-6833

    02/06/2022, 3:46 PM
    This looks really useful. I feel that web components and htmx should work together well.
  • h

    hundreds-camera-24900

    02/06/2022, 4:17 PM
    I never really got web components
  • h

    hundreds-camera-24900

    02/06/2022, 4:17 PM
    I've done a couple small things with them
  • h

    hundreds-camera-24900

    02/06/2022, 4:18 PM
    but they still feel very client side to me
  • h

    hundreds-camera-24900

    02/06/2022, 4:18 PM
    and I never really understood how to merge that w/ backend rendering
  • g

    gorgeous-airport-54386

    02/06/2022, 4:37 PM
    your backend creates semantic markup, the component either parses the markup or directly includes it with ``s. All client-rendered stuff happens in a shadow DOM, which means you don't get issues with htmx history
  • g

    gorgeous-airport-54386

    02/06/2022, 4:37 PM
    I'll explain this better when I have a keyboard
  • h

    hundreds-camera-24900

    02/06/2022, 4:39 PM
    yeah I'd love to hear someone familiar with them w/r/t backend explain it
1...454647...100Latest