Some third-party database backends (MSSQL) have custom
delete_model() requirements that must be executed.
Thanks Michael Manfre for the initial patch and review.
Backport of 4dcc2a195595f8d7ddad45bc4baf98ffdeec7f41 from master
Check that the foreign object `from_fields` are a subset of any unique
constraints on the foreign model.
Backport of 80dac8c33e7f6f22577e4346f44e4c5ee89b648c and
c7aff31397a7228f6ac2e33c10ebdf36c4b7a9b7 from master
Fixed on other backends by 134ca4d438bd7cbe8f0f287a00d545f96fa04a01.
Thanks Mariusz Felisiak for the solution.
Backport of 7a5b7e35bf2e219225b9f26d3dd3e34f26e83e9c from master
Pickling a `SimpleLazyObject` wrapping a model did not work correctly; in
particular it did not add the `_django_version` attribute added in 42736ac8.
Now it will handle this and other custom `__reduce__` methods correctly.
Backport of 35355a4ffedb2aeed52d5fe3034380ffc6a438db from master
Without an explicit 'level', only messages at WARNING or higher
are handled. This makes the config consistent with the docs
which say, "The django catch-all logger sends all messages at
the INFO level or higher to the console."
Reverted "Fixes #24727 -- Prevented ClearableFileInput from masking
exceptions on Python 2" and added a regression test.
This reverts commit 5c412dd8a724b263489c1bd7a2fea381460665d7.
This commits lifts the restriction that the outermost atomic block must
be declared with savepoint=False. This restriction was overly cautious.
The logic that makes it safe not to create savepoints for inner blocks
also applies to the outermost block when autocommit is disabled and a
transaction is already active.
This makes it possible to use the ORM after set_autocommit(False).
Previously it didn't work because ORM write operations are protected
with atomic(savepoint=False).
The old names were downright confusing. Some seemed to mean the opposite
of what the class actually did.
The new names follow a consistent nomenclature:
(Forward|Reverse)(ManyToOne|OneToOne|ManyToMany)Descriptor.
I mentioned combinations that do not exist in the docstring in order to
help people who would search for them in the code base.
Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
Moved data loss check when assigning to a reverse one-to-one relation on
an unsaved instance to Model.save(). This is exactly the same change as
e4b813c but for reverse relations.
urlparse() fails with an AttributeError ("'__proxy__' object has no
attribute 'decode'") if reverse_lazy is used to look up the URL
(this is exactly the same problem that caused ticket #18776). The
solution is to use force_str() on the path before handing it to
urlparse().