Skip to content

Commit a46255d

Browse files
committed
Fixes #13064: Ensure unchecked checkboxes do not revert to original values upon HTMX form refresh
1 parent 6093deb commit a46255d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

netbox/netbox/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def _setting(name, default=None):
355355
'django.contrib.messages',
356356
'django.contrib.staticfiles',
357357
'django.contrib.humanize',
358+
'django.forms',
358359
'corsheaders',
359360
'debug_toolbar',
360361
'graphiql_debug_toolbar',
@@ -430,6 +431,9 @@ def _setting(name, default=None):
430431
},
431432
]
432433

434+
# This allows us to override Django's stock form widget templates
435+
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
436+
433437
# Set up authentication backends
434438
if type(REMOTE_AUTH_BACKEND) not in (list, tuple):
435439
REMOTE_AUTH_BACKEND = [REMOTE_AUTH_BACKEND]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% comment %}
2+
Include a hidden field of the same name to ensure that unchecked checkboxes
3+
are always included in the submitted form data.
4+
{% endcomment %}
5+
<input type="hidden" name="{{ widget.name }}" value="">
6+
{% include "django/forms/widgets/input.html" %}

0 commit comments

Comments
 (0)