Since 1.7 models need to declare an explicit app_label if they are not
in an application in INSTALLED_APPS or were imported before their
application was loaded.
Backport of 235124d3eaf6cc7ab9f97f1d1467d1caf18e1016 from master
If importing or initializing a template backend fails, attempting to
access this template backend again must raise the same exception.
Backport of 44ad6915 from master
In addition to ImproperlyConfigured, Engine.get_default() may also raise
ImportError or other exceptions. It's better to catch all exceptions in
places where the default engine isn't strictly required.
Backport of 27f9ff45 from master
The function no longer flushes zfile after each write as doing so can
lead to the gzipped streamed content being larger than the original
content; each flush adds a 5/6 byte type 0 block. Removing this means
buf.read() may return nothing, so only yield if that has some data.
Testing shows without the flush() the buffer is being flushed every 17k
or so and compresses the same as if it had been done as a whole string.
Backport of caa3562d5bec1196502352a715a539bdb0f73c2d from master
Cleared caching in staticfiles_storage and get_finder when
relevant settings are changed.
Backport of 2730dad0d7c425f33f1ecc6cec01fdbf1cdd8376 from master
A change in Python test discovery [1] causes the old packages that raised
an error to be discovered; now we use a common directory that's
ignored during discovery. Refs #23763.
[1] http://bugs.python.org/issue7559
Backport of c0cc8f69e7abfa8578729031f97ae4b96c5cdafe from master
This reverts commit e8171daf0cd7f0e070395cb4c850c17fea32f11d.
A new solution is forthcoming.
Backport of 0e489c19f1554ecfd9825daacfbac73be8ce723e from master
make_bytes() assumed that if the Content-Encoding header is set, then
everything had already been dealt with bytes-wise, but in a streaming
situation this was not necessarily the case.
make_bytes() is only called when necessary when working with a
StreamingHttpResponse iterable, but by that point the middleware has
added the Content-Encoding header and thus make_bytes() tried to call
bytes(value) (and dies). If it had been a normal HttpResponse,
make_bytes() would have been called when the content was set, well
before the middleware set the Content-Encoding header.
This commit removes the special casing when Content-Encoding is set,
allowing unicode strings to be encoded during the iteration before they
are e.g. gzipped. This behaviour was added a long time ago for #4969 and
it doesn't appear to be necessary any more, as everything is correctly
made into bytes at the appropriate places.
Two new tests, to show that supplying non-ASCII characters to a
StreamingHttpResponse works fine normally, and when passed through the
GZip middleware (the latter dies without the change to make_bytes()).
Removes the test with a nonsense Content-Encoding and Unicode input - if
this were to happen, it can still be encoded as bytes fine.
Backport of 250aa7c39b from master.
The method is mainly intended for use with UUIDField. For UUIDField we
want to call the field's default even when primary key value is
explicitly set to None to match the behavior of AutoField.
Thanks to Marc Tamlyn and Tim Graham for review.
Backport of 8adc59038cdc6ce4f9170e4de2d716d940e136b3 from master
Specifically in rendering shortcuts, template responses, and class-based
views that return template responses.
Also added a test for render_to_response(status=...) which was missing
from fdbfc980.
Thanks Tim and Carl for the review.
Backport of 2133f31 from master.
Conflicts:
docs/topics/http/shortcuts.txt
tests/generic_views/test_base.py
This function is unused since dce820ff70f00e974afd3e6e310aa825bc55319f
after being introduced in 718a5ba1a1a77374c26b134ded46dab13776d1a1
Backport of a53541852d5601232899e54d66e623bc163c6dc2 from master
This method was inadvertently reintroduced in
f59fd15c4928caf3dfcbd50f6ab47be409a43b01
Backport of 99ca7c2bd3e04b343f4a0fe2d5add7c6d6f3a456 from master
This reverts commit da79ccca1d34f427952cce4555e598a700adb8de.
This optimized the unsuccessful case at the expense of the successful one.
Backport of 293fd5da5b8c7b79bd34ef793ab45c1bb8ac69ea from master
An explicit `__exact` lookup in the related managers filters
was interpreted as a reference to a foreign `exact` field.
Thanks to Trac alias zhiyajun11 for the report, Josh for the investigation,
Loïc for the test name and Tim for the review.
Backport of eb4cdfbdd64a95b303eaaa40a070521aa58362fd from master