Now that the URL is always unescaped as of refs #22267,
we should re-escape it before inserting it into the anchor.
Backport of 7b1a67cce52e5c191fbfa1bca501c6f0222db019 from master
This may cause some backwards compatibility issues, but may also
resolve security issues in third party projects that fail to heed warnings
in our documentation.
Thanks Markus Holtermann for help with tests and docs.
Backport of fa350e2f303572ee8f9a8302dda45a12288d3d95 from master
The query used a construct of qs.annotate().values().aggregate() where
the first annotate used an F-object reference and the values() and
aggregate() calls referenced that F-object.
Also made sure the inner query's select clause is as simple as possible,
and made sure .values().distinct().aggreate() works correctly.
Backport of fb146193c49e4c683dc8da39d9b7c479375fdb57 from master
When altering from e.g. an IntegerField to a ForeignKey, Django didn't
add a constraint.
Backport of f4f0060feaee6bbd76a0d575487682bc541111e4 from master
Since a4b8a4b632dbb6d9fed1a8654aed99a9c53560d4 the admin
URL returned by get_admin_url() is no longer relative to
the Django admin index page.
Backport of 85757d0e79f4237d7cf3ee1785946315aa6959eb from master
These cached properies were causing problems with pickling, and in
addition they were confusingly defined: field.rel.model._meta was
not the same as field.rel.opts.
Instead users should use field.rel.related_model._meta inplace of
field.rel.opts, and field.rel.to._meta in place of field.rel.to_opts.
Backport of f95122e541df5bebb9b5ebb6226b0013e5edc893 from master
Switched from an adjancency list and uncached, iterative depth-first
search to a Node-based design with direct parent/child links and a
cached, recursive depth-first search. With this change, calculating
a migration plan for a large graph takes several seconds instead of
several hours.
Marked test `migrations.test_graph.GraphTests.test_dfs` as an expected
failure due to reaching the maximum recursion depth.
Backport of 78d43a5e1064b63db1c486516c4263ef1c4c975c from master
The new signature enables better support for routing RunPython and
RunSQL operations, especially w.r.t. reusable and third-party apps.
This commit also takes advantage of the deprecation cycle for the old
signature to remove the backward incompatibility introduced in #22583;
RunPython and RunSQL won't call allow_migrate() when when the router
has the old signature.
Thanks Aymeric Augustin and Tim Graham for helping shape up the patch.
Refs 22583.
Conflicts:
django/db/utils.py
Backport of bed504d70bede3431a213203c13a33905d6dbf77 from master
As suggested by Anssi. This has the slightly strange side effect of
passing the expression to Expression.convert_value has the expression
passed back to it, but it allows more complex patterns of expressions.
Backport of 32d4db66b9 from master
Joint effort between myself, Josh, Anssi and Shai.
Conflicts:
django/db/models/query.py
tests/model_fields/models.py
Backport of 4755f8fc25331c739a6f932cc8aba0cc9e62e352 from master.
This opens more possibilities, like accessing context.template.origin.
It also follows the chain of objects instead of following a shortcut.
Backport of 1bfcc95 from master
Workaround for http://bugs.python.org/issue20747.
In some corner cases, Python 2 inserts a newline in a header value
despite `maxlinelen` passed in Header constructor.
Thanks Tim Graham for the review.
Backport of efb1f99f94 from master.
Swapped out models don't have a _default_manager unless they have
explicitly defined managers. ModelState.from_model() now accounts for
this case and uses an empty list for managers if no explicit managers
are defined and a model is swapped out.
Backport of 15dc8d1c9d3697170a2c59ecaa7a2b4ba58f5990 from master
If Django is installed in a path that contains non-ASCII characters,
the tag failed with UnicodeDecodeError.
Backport of 098fa12dd390e733c7568d824eea2c346550c75a from master
The function implemented most of upath(), but skipped the check for
strings that are already unicode.
Backport of bad6280c4e3f75f3ccd27f8fd85a4043bb296128 from master
If 'name' contained non-ASCII characters, the comparison raised a
UnicodeEncodeError on Python 2.
Backport of 63c5c9870129f6b81358c1ed7ed2392bbc46f77d from master