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

    early-camera-41285

    12/17/2022, 7:13 PM
    Haha, that sounds awful. I regret going down the IIIF route except that it is an industry standard for these kinds of artifacts, so, gotta make it work. I have another web app going live soon that is also much more sophisticated than a blog, but the front end is entirely HTMX. I'll pop them into the showcase channel eventually
  • r

    ripe-ghost-5606

    12/17/2022, 7:16 PM
    I'll keep an eye out for them there - thanks
  • b

    breezy-diamond-95556

    12/19/2022, 2:27 AM
    Sorry, noob here... I am doing something close to the modal example from the htmx site. I have a button: <button hx-get="{% url 'notable:add_notebook' %}" hx-target="#modals-here" hx-trigger="click" _="on htmx:afterOnLoad wait 10ms then add .show to #modal then add .show to #modal-backdrop"> Add a notebook that loads a form in a modal: {% load crispy_forms_tags %} {% csrf_token %} Add Notebook {{ form|crispy }} Cancel Save If my response is a coded as a 201 the modal will close itself but if I use something else like a 204 the modal doesn't close. What do I need to do differently to get the modal to close? I've tried a few things with hyperscipt but I'm not having any luck.
  • b

    blue-gold-89534

    12/19/2022, 11:16 PM
    https://htmx.org/docs/#requests check this. Youshould not answer with 204
  • a

    abundant-intern-86613

    12/24/2022, 1:59 PM
    hi do you have any idea about hx-trigger="{% url 'offer:search_suppliers' %}?q={val}" this code can trigger and get val parameters for input field i m fighting with openai πŸ™‚ he/she said thant it is possible
  • h

    hundreds-camera-24900

    12/24/2022, 9:21 PM
    trigger is the event to watch for, in order to kick off a request
  • h

    hundreds-camera-24900

    12/24/2022, 9:21 PM
    you likely want hx-get with the url value, and then hx-trigger for keyup or input on the field
  • w

    white-motorcycle-95262

    12/29/2022, 2:21 PM
    What do people think about setting HTMX attributes in .py files? e.g.
    Copy code
    class MyForm(forms.Form):
    
      region = forms.ModelChoiceField(
        Region,
      )
      dataset = forms.ModelChoiceField(
        Dataset,
      )  
      def __init__(self, *args, **kwargs):
          """Set form settings."""
    
          # Add HTMX or Hyperscript
          self.fields['region'].widget.attrs.update({
            'hx-trigger': "load, change",
            'hx-get': "/historical/",
            'hx-target': "#id_dataset",
            'hx-swap': 'outerHTML',
          })
          self.fields['dataset'].widget.attrs.update({
             'hx-trigger': "load, change, htmx:afterSettle",
            'hx-get': "/historical/",
            'hx-include': "[name='region']",
            'hx-target': "#id_table",
            'hx-swap': 'outerHTML',
            '_': """
              on load or change
                <do some stuff>
              end
            """
          })
  • b

    best-barista-27777

    12/29/2022, 4:02 PM
    I've been doing this on dependent/chained dropdowns and it has been working great.
  • w

    white-motorcycle-95262

    12/29/2022, 4:04 PM
    Yeah, that's my particular use case. But in general, I find it's not easy to add these attributes on the fly in a django template unless you use a wrapper div
  • m

    modern-continent-13743

    01/04/2023, 3:46 AM
    Hello guys, novice programmer here, nice to meet you all
  • r

    rich-television-50179

    01/04/2023, 12:53 PM
    Hi All. I am trying to read/learn HTMX. I have a simple button shown below:
    Copy code
    <button id="delete-button" hx-post="/delete" hx-confirm="Are you sure you want to delete?">Delete Me!</button>
    When I load the web app and check console, it shows that
    Copy code
    htmx.min.js
    was loaded successfully but for some reason when I click the button nothing happens. No browser confirm alert or post request. I use Firefox Developer Edition for my preferred browser.
  • r

    rich-television-50179

    01/04/2023, 1:39 PM
    Any help is appreciated.
  • h

    hundreds-camera-24900

    01/04/2023, 2:52 PM
    That looks right - can you both add logAll and MonitorEvents on the button and see what's spit out? https://htmx.org/docs/#debugging
  • r

    rich-television-50179

    01/04/2023, 2:59 PM
    I did and all it outputs is this
  • h

    hundreds-camera-24900

    01/04/2023, 3:31 PM
    no event when you click the button? from monitor events?
  • r

    rich-television-50179

    01/04/2023, 3:34 PM
    I got it figured out πŸ˜„ Thank you!
  • h

    hundreds-camera-24900

    01/04/2023, 3:34 PM
    πŸ‘
  • r

    refined-waiter-90422

    01/04/2023, 5:04 PM
    dang, half the comments in that thread include htmx. Nice to see.
  • m

    mysterious-toddler-20573

    01/04/2023, 5:15 PM
    yep, life is funny
  • m

    mysterious-toddler-20573

    01/04/2023, 5:15 PM
    never worked w/ django in my life
  • i

    important-van-94053

    01/04/2023, 8:02 PM
    Django was in a weird state with it having a huge lot of features for β€œfull stack” sites, yet it ended up used only for JSON APIs (with the Django REST (heh) Framework) serving JSON to a JS frontend. So they started having a separate JS frontend folder/build in repos and some tooling around that, but it possibly felt sad to see, given all Diango could do frontend-wise using templates. I think the community feels like it can leverage the whole framework again and it must feel liberating!
  • h

    hundreds-camera-24900

    01/04/2023, 9:27 PM
    we did that, switched back to htmx from next
  • h

    hundreds-camera-24900

    01/04/2023, 9:27 PM
    way simpler imho
  • a

    average-fireman-41481

    01/05/2023, 3:41 PM
    Cross posting from #941388608290574336 as I just realized there is a dedicated #864934037381971988 channel πŸ”₯ I recently deployed and finished building my very first django webapp that heavily uses htmx. The web app allows you to merge multiple iCalendar feeds into a single feed. I would really appreciate any feedback. And if your the pair programming type DM me as id love to walk you through the code and hear your feedback https://github.com/abe-101/calmerge
  • a

    average-fireman-41481

    01/05/2023, 3:42 PM
    https://discord.com/channels/725789699527933952/941388608290574336/1059980707499364412
  • m

    magnificent-boots-1658

    01/05/2023, 4:44 PM
    This is a super cool tool!
  • a

    average-fireman-41481

    01/05/2023, 7:46 PM
    Thank you. I really like how it solves a real world problem. I became aware of this issue while volunteering at Code and Coffee, where we were dealing with over 20 meetup groups across the US, each with their own iCalendar feed. It was a real hassle trying to keep track of all of the events, but calmerge aims to make it much easier
  • r

    rich-television-50179

    01/05/2023, 7:58 PM
    Abe. What exactly is it supposed to do? Is the app basically taking multiple calendars and putting them into one? Am I understanding that correctly?
  • a

    average-fireman-41481

    01/05/2023, 8:19 PM
    Calmerge allows you to merge calendar feeds (including future events) For example, let's say you're interested in events from multiple Meetup groups in your area. Meetup.com publishes a calendar feed for every group, so you could add all 20 feeds to your calendar client, but then if you wanted to toggle them all off you'd have to do so separately for each feed. With Calmerge, you can merge all of those feeds into a single feed and then add it to your calendar client. This way, you can easily toggle all of the events on and off at once. Another benefit is that you can share the merged feed with others who have similar interests
1...878889...100Latest