https://htmx.org logo
Join Discord
Powered by
# πŸ”₯-django-htmx
  • v

    victorious-cat-12942

    09/13/2022, 4:11 PM
    Ah no problem
  • v

    victorious-cat-12942

    09/13/2022, 4:11 PM
    I’ll mess with it
  • v

    victorious-cat-12942

    09/13/2022, 4:13 PM
    I think I may be able to do a swap on the element
  • v

    victorious-cat-12942

    09/13/2022, 4:17 PM
    Do you know how to do that with htmx make a lazy load trigger a swap
  • t

    tall-dinner-62086

    09/13/2022, 4:22 PM
    By default a swap is triggered on every htmx request. If you return html from that endpoint, it will be swapped. You said you put code on a div, but if you put it on the actual select element you don't even have to bother with
    hx-target
    . For example,
    Copy code
    html
    <!-- form -->
    <select hx-trigger="load" hx-get="/get/my/options"></select>
    
    <!-- return from /get/my/options -->
    <option>option 1</option>
    <option>option 2</option>
  • v

    victorious-cat-12942

    09/13/2022, 4:30 PM
    Oh perfect thx
  • h

    hundreds-camera-24900

    09/13/2022, 5:25 PM
    do people still use csrf, I'm thinking about turning it off as a default
  • b

    bitter-monkey-50309

    09/13/2022, 6:03 PM
    Yep.
    SameSite
    cookies don't offer full protection and personally I don't think it's much of a hassle to include CSRF tokens as Django makes it pretty simple
  • h

    hundreds-camera-24900

    09/13/2022, 6:03 PM
    what protection don't they offer?
  • b

    bitter-monkey-50309

    09/13/2022, 6:07 PM
    Well
    Strict
    does protect, but it has the oddity of if you click a link from another website when you should be authenticated you're not actually logged in because the cookies aren't sent, so for UX I (personally) wouldn't use that. And
    Lax
    lets
    GET
    requests pass the cookie and sometimes I'm dumb and things happen on those requests that I wouldn't necessarily want
  • h

    hundreds-camera-24900

    09/13/2022, 6:26 PM
    I think I can basically 100% automate the csrf token w/ htmx so it feels like from a DX pov it doesn't really matter
  • h

    hundreds-camera-24900

    09/13/2022, 6:26 PM
    but it's slightly more code to carry around
  • b

    bland-coat-6833

    09/13/2022, 9:56 PM
    I think the approach I've seen with
    SameSite
    is to have two cookies - one
    Lax
    for GETs or non-destructive access, and another
    Strict
    one for `POST`s or changing data. But you still have to remember to not do something stupid in the wrong route.
  • p

    proud-librarian-99598

    09/20/2022, 1:28 PM
    I have the same issue.
    useTemplateFragments
    also not fixing it. Did you find a solution for it?
  • p

    proud-librarian-99598

    09/20/2022, 1:41 PM
    To answer my own question: I changed from returning
    <tr>
    elements to returning the full
    <table>
    and that makes it work.
  • f

    flat-painting-36912

    09/21/2022, 10:11 PM
    Hey guys
  • f

    flat-painting-36912

    09/21/2022, 10:11 PM
    Django + Vue + HTMX, good idea ?
  • f

    flat-painting-36912

    09/21/2022, 10:11 PM
    I’m building an app at work that requires a little interactivity (like a DateTimePicker)
  • f

    flat-painting-36912

    09/21/2022, 10:12 PM
    I want it to look nice but there’s not too much going on interactivity-wise, is Vue overkill? I was thinking maybe Bootstrap-Vue or something.
  • f

    flat-painting-36912

    09/21/2022, 10:12 PM
    My colleague and I don’t want to write a lot of JS so we’d use HTMX for the API calls.
  • f

    flat-painting-36912

    09/21/2022, 10:12 PM
    Is this a good idea ?
  • f

    flat-painting-36912

    09/21/2022, 10:17 PM
    It feels dirty to pull in Vue just to get a nice-looking datetimepicker.
  • g

    gorgeous-airport-54386

    09/21/2022, 10:19 PM
    is input[type=datetime-local] not enough or not available?
  • f

    flat-painting-36912

    09/21/2022, 10:32 PM
    My issue with that is that I don’t know how to make it look nice ?
  • a

    ancient-shoe-86801

    09/21/2022, 11:13 PM
    is that the only component you feel you cannot make nice with the CSS library of your choice?
  • a

    ancient-shoe-86801

    09/21/2022, 11:18 PM
    this shows how to customize the default HTML element, if you don't like each browser styling it differently: https://stackoverflow.com/a/71556798/1101750
  • b

    bland-coat-6833

    09/22/2022, 10:48 AM
    https://dev.to/codeclown/styling-a-native-date-input-into-a-custom-no-library-datepicker-2in looks like it has some tips @flat-painting-36912
  • c

    cuddly-keyboard-70746

    09/22/2022, 12:13 PM
    my issue with that is that you are probably going to end up writing something that is not accesible
  • c

    cuddly-keyboard-70746

    09/22/2022, 12:14 PM
    styling it is your best bet
  • f

    flat-painting-36912

    09/22/2022, 12:34 PM
    Thanks guys πŸ™‚
1...727374...100Latest