This is a performance optimization and also fixes test errors with the
upcoming merge of contrib tests into tests/. The tests failed on MySQL
because the models with GeometryField were being checked but the
non-GIS MySQL backend didn't know how to handle them.
Backport of 197dd4b8f12164f6acebb3b959f9ac2040a40400 from master
During the autumn DST change, the template engine would fail to convert
the naive representation of now when USE_TZ = True. Passing now in UTC
eliminates the issue.
Thanks mbertheau and tricoder42.
Refs #23714.
Backport of c7a6996df7e77bc3b9c5e581e67d766627ebabec from master
This reduces the length of rope RequestContext gives users to hang
themselves with.
Thanks Alex Hill for the report and Tim Graham for the review.
Backport of f2c104a from master.
Refs #15779. This will allow easier admin URL changes, when needed.
Thanks Simon Charette for the review.
Backport of 32e6a7d3a57b2287d55e8b8efa4e8cb7643b1720 from master
This significantly improves performance on PyPy. The previous
implementation would generate a new class on every single request,
which is relatively slow.
Backport of 8099d33b6553c9ee7de779ae9d191a1bf22adbda from master
This dramatically improves performance on PyPy. The following benchmark:
python -mtimeit -s "from django.utils.functional import allow_lazy; from django.utils.translation import ugettext_lazy; f = allow_lazy(lambda s: s, str)" "f(ugettext_lazy('abc'))"
goes from 390us per loop to 165us.
Backport of 82e0cd15711c7171aed7af5e481967cc721c9642 from master
This script uses the unmaintained hotshot module (gone on Python 3)
and doesn't seem to be Django specific in any way.
Backport of 388d986b8a6bb1363dab9f53ea435dff4dfe92cb from master
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