Thanks to charettes and priidukull for investigating the issue, and to
kurevin for the report.
Backport of 355c5edd9390caad5725375abca03460805f663b from master
Fixed queries where an expression was used in order_by() but the
expression wasn't in the query's select clause (for example the
expression could be masked by .values() call)
Thanks to Trac alias MattBlack85 for the report.
Backport of fb5c7748da from master.
Instead of setting ``warning_stream`` in the docutils config overrides
to ``False`` I opted for filtering the stderr in the tests to keep the
error output showing up in server logs.
Thanks Tim Graham for the report and review
Backport of 3caf7efb44712f89d6552076c240a3c898673a2c from master
This also prevents state modifications from corrupting previous states.
Previously, when a model defining a relation was unregistered first,
clearing the cache would cause its related models' _meta to be cleared
and would result in the old models losing track of their relations.
Backport of 0385dad073270c37f8c4a5f13edce43f2a69ba8a from master
Fixed MigrationWriter.serialize() to correctly handle migration
operations by utilizing OperationWriter.
Thanks Piotr Maliński for the report.
Backport of e8e4f978dd4b7a3d0c689c6e3301e3c6f9e50003 from master
Changed OperationWriter to support multi-line serialized values with
correct indentation.
Backport of d597174bd4cfd9a0e1b34dae8b4d8d027a8cab72 from master
get_language() can return None when translations are deactivated.
Thanks Nicola Peduzzi for the reporti and Tim Graham for the review.
Backport of 7a0d9b5cda from master.
This change:
* Makes the InclusionNode cache-safe by removing render-time side effects
to its nodelist.
* Ensures the render_context stack is properly scoped and reset by updating
the render call to use Template.render rather than Nodelist.render.
Backport of 0808ccce3808235c5b5a56e3f689cec0d4bc0ebf from master
Rendering a Jinja template with self in the context threw an error.
While self is a reserved variable in Jinja, including self in the
context is not an error, so Django should respect that.
Backport of 4ea1909d3c420ba1fbdbf7221cad518d43aef885 from master
When reversing, only outer parameters are used if captured parameters are
nested. Added tests to check the edge cases and documentation for the
behavior with an example to avoid it.
Backport of 23a5d64f40b0f4a3fbfef7427ca793cb1df1034e from master
Fixed create_default_site() to use a default value in case
settings.SITE_ID isn't set; refs #23945.
Backport of 818182b514d1c6b379130c440689355b4d231d49 from master
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