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

    prehistoric-cat-63987

    05/07/2023, 3:53 PM
    I'll explain how I later go with it once everything works as expected
  • p

    prehistoric-cat-63987

    05/07/2023, 4:08 PM
    There's no explanation on where received from ws are stored, or how I can retrieve and work with them in the websocket extension docs

    https://cdn.discordapp.com/attachments/864934037381971988/1104801826995449876/Screenshot_20230507-170631.png▾

  • g

    great-cartoon-12331

    05/07/2023, 4:40 PM
    is it as simple as using e.g. daphne and adding async/await calls everywhere? we don't need to use async I/O libraries written from the ground up to be concurrent?
  • r

    refined-waiter-90422

    05/07/2023, 4:48 PM
    Yeah you'll need to switch your django calls to the async ones. It's all really new stuff from 4.1+
  • r

    refined-waiter-90422

    05/07/2023, 4:53 PM
    To get a bigger boost, call a bunch of API endpoints at once with
    asyncio.gather(...)
  • r

    refined-waiter-90422

    05/07/2023, 4:54 PM
    Once you're over on ASGI you can migrate things to async one endpoint at a time.
  • g

    great-cartoon-12331

    05/07/2023, 4:55 PM
    ok, so on asgi blocking calls won't break my app?
  • r

    refined-waiter-90422

    05/07/2023, 4:55 PM
    It'll just block, as usual.
  • s

    shy-zebra-22292

    05/08/2023, 6:27 AM
    Hello guys! I am looking to understand how this "magic" happens: In the video he clearly shows that he is replacing the whole
    <input>
    and then when the
    swap
    happens the input is still focused and he can continue to type 😮 . video at the specific time:

    https://youtu.be/Fh2iDdASxjE?t=374▾

    how does this happen behind the scenes?
    morphdom
    or something else? how can I reproduce that without django-htmx?
  • r

    ripe-action-67367

    05/08/2023, 6:53 AM
    Give the input an ID https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L3274-L3291
  • s

    shy-zebra-22292

    05/08/2023, 8:27 AM
    That is totally awesome! Thanks a lot 🙏 💗
  • s

    salmon-oil-67352

    05/08/2023, 4:50 PM
    Hello everyone! 👋 I'm planning to submit a talk proposal for DjangoCon 2023 titled "Revolutionizing Development with Advanced Generic Views in Django" and would love to get your feedback. You can find the talk details here: https://pretalx.com/djangocon-us-2023/talk/review/LCVZ8ZFFGNBDFTJHZZMF3FGHDHTHYMW9 Please let me know your thoughts on the topic, structure, and overall appeal of the talk. Any suggestions to make it more engaging and relevant to the Django community are highly appreciated! (HTMX is used and demonstrated in the talk) In attachment you can find the as will in image format Thanks in advance for your input! 😊

    https://cdn.discordapp.com/attachments/864934037381971988/1105174889972908103/image.png▾

  • a

    aloof-psychiatrist-85938

    05/09/2023, 4:45 AM
    how do you guys seperate URL routes for HTMX (either combine HTMX routes with standard routes or have seperate routes for HTMX)
  • a

    aloof-psychiatrist-85938

    05/09/2023, 4:46 AM
    i've tried both but interested to see what others are doing in the space
  • g

    great-cartoon-12331

    05/09/2023, 4:47 AM
    i think the standard practice is to handle either case in a single handler
  • a

    aloof-psychiatrist-85938

    05/09/2023, 4:49 AM
    yeah i just find doing that makes the view little bit bloated
  • g

    great-cartoon-12331

    05/09/2023, 5:50 AM
    you could always split up the views into pairs of methods one each for htmx/non-htmx requests
  • s

    strong-addition-37567

    05/09/2023, 4:57 PM
    Anyone have some experience/suggestions on how to write tests? We've built a pretty complex htmx+alpinejs page and currently have only tests for the page rendering code. Ideally we could test that the interactions work as expected. eg: changing the input value results in a htmx request that updates some subsection of the page and updates some FE error messages. We have some basic tests using LiveServerTestCase and selenium, but testing every edge-case of a page interaction this way seems hard to maintain long term. Any and all suggestions welcome!
  • r

    refined-waiter-90422

    05/09/2023, 5:09 PM
    Playwright, pytest, doctest
  • r

    refined-waiter-90422

    05/09/2023, 5:10 PM
    I wonder if async is supported in doctest yet
  • s

    strong-addition-37567

    05/09/2023, 5:25 PM
    Playwright looks interesting, reading more about it now! Have you seen it perform faster than a selenium+LiveServerTestCase?
  • r

    refined-waiter-90422

    05/09/2023, 5:40 PM
    Haven't used selenium forever because playwright is literally just python + a browser of your choice.
  • r

    refined-waiter-90422

    05/09/2023, 5:42 PM
    Don't need to call in the Javatar.
  • f

    flaky-agent-58045

    05/09/2023, 11:15 PM
    one advantage of separate routes: no worries about caching, or having to set 'Vary' header
  • g

    great-cartoon-12331

    05/09/2023, 11:24 PM
    true, but you don't necessarily need a separate route for that https://discord.com/channels/725789699527933952/725789747212976259/1104985302625419344
  • a

    aloof-psychiatrist-85938

    05/10/2023, 1:52 AM
    yeah initially when i started with HTMX i was combining routes due to how i'd observed others implementations, though over time i found myself splitting them out as it just felt cleaner to me
  • s

    stocky-autumn-20996

    05/11/2023, 8:09 PM
    Guys, how can I make it so that when adding a new set the value of the previous one is not lost?

    https://cdn.discordapp.com/attachments/864934037381971988/1106312105445036053/image.png▾

  • h

    handsome-gpu-11538

    05/12/2023, 5:32 PM
    A question on how to deal with
    @login_required
    views in htmx... If we generate a page for a user, and then they (via another page) logout, when they act to generate a new htmx response, they get a login page inserted into the block... Since this is from
    @login_required
    , I am unable to code anything in the view itself to handle this issue. I'm a little surprised that it doesn't seem that htmx has a built in solution for what seems like would be a very common issue. Am I just missing it, or is there actually a recommended solution?
  • h

    handsome-gpu-11538

    05/12/2023, 5:32 PM
    It doesn't seem like the proper solution is "remove `@login_required`"...
  • h

    handsome-gpu-11538

    05/12/2023, 5:34 PM
    I surprisingly only found one stack overflow talking about it, and it had a hacky solution that didn't seem bulletproof... https://stackoverflow.com/questions/71002060/how-to-handle-redirect-for-login-required-in-htmx-partial-view
1...96979899100Latest