[Django] #35647: Templating Engine Auto-Closing Forms

5 views
Skip to first unread message

Django

unread,
Jul 31, 2024, 10:50:33 AM7/31/24
to django-...@googlegroups.com
#35647: Templating Engine Auto-Closing Forms
-------------------------------------+-------------------------------------
Reporter: Nischal lamichhane | Type: Bug
Status: new | Component: Template
| system
Version: 4.2 | Severity: Release
| blocker
Keywords: templating engine | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I was Trying to integrate HTMX into my django application's frontend. and
noticed a weird and what seems like a breaking issue.
Following is the html code that I have in my html file being rendered:
<form
hx-post="{% url 'batch_delete' pk=batch.id %}"
hx-trigger="submit"
hx-target="#batchesListCard"
hx-swap="innerHTML"
hx-on::before-request="$(this).closest('.modal').modal(hide)"
>
{% csrf_token %}
<button
type="submit"
class="btn btn-danger mt-3">
Yes
</button>
</form>
Following is what is seen my inspecting Element in my Browser.
<form hx-post="/batches/22/delete/" hx-trigger="submit" hx-
target="#batchesListCard" hx-swap="innerHTML" hx-on::before-
request="$(this).closest('.modal').modal(hide)"></form>
<input type="hidden" name="csrfmiddlewaretoken" value="csrf_value">
<button type="submit" class="btn btn-danger mt-3">
Yes
</button>

As you can see, the form is being auto-closed by the templating engine,
The error however isnt in every form, It is happening to the form(with no
user input) that is used with htmx to be used as a trigger.
--
Ticket URL: <https://code.djangoproject.com/ticket/35647>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 31, 2024, 10:53:25 AM7/31/24
to django-...@googlegroups.com
#35647: Templating Engine Auto-Closing Forms
------------------------------------+--------------------------------------
Reporter: Nischal lamichhane | Owner: (none)
Type: Bug | Status: new
Component: Template system | Version: 4.2
Severity: Release blocker | Resolution:
Keywords: templating engine | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Comment (by Nischal lamichhane):

Please contact me if you need more information to reproduce the bug
--
Ticket URL: <https://code.djangoproject.com/ticket/35647#comment:1>

Django

unread,
Jul 31, 2024, 11:37:25 AM7/31/24
to django-...@googlegroups.com
#35647: Templating Engine Auto-Closing Forms
------------------------------------+--------------------------------------
Reporter: Nischal lamichhane | Owner: (none)
Type: Bug | Status: new
Component: Template system | Version: 4.2
Severity: Release blocker | Resolution:
Keywords: templating engine | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Description changed by Sarah Boyce:

Old description:
New description:
--
Ticket URL: <https://code.djangoproject.com/ticket/35647#comment:2>

Django

unread,
Jul 31, 2024, 11:59:22 AM7/31/24
to django-...@googlegroups.com
#35647: Templating Engine Auto-Closing Forms
------------------------------------+--------------------------------------
Reporter: Nischal lamichhane | Owner: (none)
Type: Bug | Status: closed
Component: Template system | Version: 4.2
Severity: Release blocker | Resolution: invalid
Keywords: templating engine | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Changes (by Sarah Boyce):

* resolution: => invalid
* status: new => closed

Comment:

I am pretty sure this is not a Django issue but instead something funky
around the htmx swapping of target and innerHTML
If you can confirm there is an issue in Django's template rendering,
independent to htmx, please reopen the issue
--
Ticket URL: <https://code.djangoproject.com/ticket/35647#comment:3>
Reply all
Reply to author
Forward
0 new messages