diff --git a/django/forms/fields.py b/django/forms/fields.py
index ab3f6876dfb4..ee8d87d92a65 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -1390,6 +1390,8 @@ def prepare_value(self, value):
return json.dumps(value, ensure_ascii=False, cls=self.encoder)
def has_changed(self, initial, data):
+ if self.disabled:
+ return False
if super().has_changed(initial, data):
return True
# For purposes of seeing whether something has changed, True isn't the
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
index 362911c55c96..ac7b161eeece 100644
--- a/docs/_ext/djangodocs.py
+++ b/docs/_ext/djangodocs.py
@@ -212,7 +212,14 @@ def depart_console_dummy(self, node):
def visit_console_html(self, node):
"""Generate HTML for the console directive."""
- if self.builder.format == "html" and node["win_console_text"]:
+ # The epub builder uses the HTML format but produces XHTML for e-readers,
+ # where the CSS-driven tabs neither work nor validate as XML, so fall back
+ # to a plain literal block there (as the non-HTML formats already do).
+ if (
+ self.builder.format == "html"
+ and self.builder.name != "epub"
+ and node["win_console_text"]
+ ):
# Put a mark on the document object signaling the fact the directive
# has been used on it.
self.document._console_directive_used_flag = True
diff --git a/docs/internals/contributing/writing-code/submitting-patches.txt b/docs/internals/contributing/writing-code/submitting-patches.txt
index a038de53f7d3..845dda6ff9cc 100644
--- a/docs/internals/contributing/writing-code/submitting-patches.txt
+++ b/docs/internals/contributing/writing-code/submitting-patches.txt
@@ -465,6 +465,34 @@ of the `Django Development Dashboard `_.
Looking to get your pull request reviewed? Ensure the Trac flags on the ticket
are set so that the ticket appears in that queue.
+All tickets
+-----------
+
+* Is the pull request a single squashed commit with a message that follows our
+ :ref:`commit message format `?
+* Are you the patch author and a new contributor? Please add yourself to the
+ :source:`AUTHORS` file. At your option, submit a
+ `Contributor License Agreement`_.
+* Does this have an accepted ticket on Trac? All contributions require a ticket
+ unless the :ref:`change is considered trivial `.
+
+All code changes
+----------------
+
+* Does the :doc:`coding style
+ ` conform to our
+ guidelines? Are there any ``black``, ``blacken-docs``, ``flake8``,
+ ``isort``, or ``zizmor`` errors? You can install the :ref:`pre-commit
+ ` hooks to automatically catch these errors.
+* If the change is backwards incompatible in any way, is there a note
+ in the release notes (``docs/releases/A.B.txt``)?
+* Is Django's test suite passing?
+* If there is a :ref:`code coverage report `
+ comment on the pull request, have you reviewed the missing coverage in
+ context (considering database/platform-specific limitations)?
+* If the change affects the Django admin or rendered HTML output, has
+ :ref:`accessibility testing ` been done?
+
Documentation
-------------
@@ -498,32 +526,4 @@ Deprecating a feature
See the :ref:`deprecating-a-feature` guide.
-All code changes
-----------------
-
-* Does the :doc:`coding style
- ` conform to our
- guidelines? Are there any ``black``, ``blacken-docs``, ``flake8``,
- ``isort``, or ``zizmor`` errors? You can install the :ref:`pre-commit
- ` hooks to automatically catch these errors.
-* If the change is backwards incompatible in any way, is there a note
- in the release notes (``docs/releases/A.B.txt``)?
-* Is Django's test suite passing?
-* If there is a :ref:`code coverage report `
- comment on the pull request, have you reviewed the missing coverage in
- context (considering database/platform-specific limitations)?
-* If the change affects the Django admin or rendered HTML output, has
- :ref:`accessibility testing ` been done?
-
-All tickets
------------
-
-* Is the pull request a single squashed commit with a message that follows our
- :ref:`commit message format `?
-* Are you the patch author and a new contributor? Please add yourself to the
- :source:`AUTHORS` file. At your option, submit a
- `Contributor License Agreement`_.
-* Does this have an accepted ticket on Trac? All contributions require a ticket
- unless the :ref:`change is considered trivial `.
-
.. _Contributor License Agreement: https://www.djangoproject.com/foundation/cla/
diff --git a/tests/forms_tests/field_tests/test_jsonfield.py b/tests/forms_tests/field_tests/test_jsonfield.py
index be2b077e640b..3224c4fb101a 100644
--- a/tests/forms_tests/field_tests/test_jsonfield.py
+++ b/tests/forms_tests/field_tests/test_jsonfield.py
@@ -80,6 +80,10 @@ def test_has_changed(self):
self.assertIs(field.has_changed({"a": True}, '{"a": 1}'), True)
self.assertIs(field.has_changed({"a": 1, "b": 2}, '{"b": 2, "a": 1}'), False)
+ def test_disabled_has_changed(self):
+ field = JSONField(disabled=True)
+ self.assertIs(field.has_changed({"a": 1}, '{"a": 2}'), False)
+
def test_custom_encoder_decoder(self):
class CustomDecoder(json.JSONDecoder):
def __init__(self, object_hook=None, *args, **kwargs):