Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Can't get request.POST with HTMX + Checked Attribute

I'm printing the POST result like this:

print(self.request.POST)

In the template, I'm trying to POST the name and value of the input field. It works when the checked attribute is not there but gives me an empty QueryDict <QueryDict: {}> when it's there as per below.

<div class="form-check form-switch">
                 <input
                   class="form-check-input"
                   type="checkbox"
                   role="switch"
                   id="survey-{{ survey.pk }}"
                   name="button"
                   value="{{ survey.published }}"
                   hx-post="{% url 'surveys:survey-toggle-status' %}"
                   hx-trigger="click"
                   hx-target="#survey-table"
           

/r/django
https://redd.it/1dn85zr