Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions django/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion docs/_ext/djangodocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 28 additions & 28 deletions docs/internals/contributing/writing-code/submitting-patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,34 @@ of the `Django Development Dashboard <https://dashboard.djangoproject.com/>`_.
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 <committing-guidelines>`?
* 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 <trivial-change>`.

All code changes
----------------

* Does the :doc:`coding style
</internals/contributing/writing-code/coding-style>` conform to our
guidelines? Are there any ``black``, ``blacken-docs``, ``flake8``,
``isort``, or ``zizmor`` errors? You can install the :ref:`pre-commit
<coding-style-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 <code-coverage-on-pull-requests>`
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 <accessibility-testing-baseline>` been done?

Documentation
-------------

Expand Down Expand Up @@ -498,32 +526,4 @@ Deprecating a feature

See the :ref:`deprecating-a-feature` guide.

All code changes
----------------

* Does the :doc:`coding style
</internals/contributing/writing-code/coding-style>` conform to our
guidelines? Are there any ``black``, ``blacken-docs``, ``flake8``,
``isort``, or ``zizmor`` errors? You can install the :ref:`pre-commit
<coding-style-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 <code-coverage-on-pull-requests>`
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 <accessibility-testing-baseline>` been done?

All tickets
-----------

* Is the pull request a single squashed commit with a message that follows our
:ref:`commit message format <committing-guidelines>`?
* 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 <trivial-change>`.

.. _Contributor License Agreement: https://www.djangoproject.com/foundation/cla/
4 changes: 4 additions & 0 deletions tests/forms_tests/field_tests/test_jsonfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading