Commit Graph

6356 Commits

Author SHA1 Message Date
Tim Graham fc1e9107d7 [1.8.x] Added UUIDField.deconstruct()
Backport of 0f54cf28c0 from master
2015-02-05 19:15:37 -05:00
Markus Holtermann c9addfd4bf [1.8.x] Fixed small regression caused by e3702dc3f2
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 235124d3ea from master
2015-02-06 00:50:42 +01:00
Markus Holtermann e3702dc3f2 [1.8.x] Cleaned up schema tests
Thanks Tim Graham for the review.

Backport of 0204714b0b from master
2015-02-05 20:15:18 +01:00
Aymeric Augustin aed1b1f6e5 [1.8.x] Fixed #24265 -- Preserved template backend loading exceptions.
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
2015-02-05 20:09:22 +01:00
Aymeric Augustin 5fbec369aa [1.8.x] Fixed #24273 -- Allowed copying RequestContext more than once.
Thanks Collin Anderson for the report.

Backport of 31d3a355 from master
2015-02-05 14:07:18 +01:00
Matthew Somerville 2a55301f9f [1.8.x] Fixed #24242 -- Improved efficiency of utils.text.compress_sequence()
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 caa3562d5b from master
2015-02-04 15:17:22 -05:00
mlavin d585ade0df [1.8.x] Fixed #24197 -- Added clearing of staticfiles caches on settings changes during tests
Cleared caching in staticfiles_storage and get_finder when
relevant settings are changed.

Backport of 2730dad0d7 from master
2015-02-04 10:54:33 -05:00
Riccardo Magliocchetti 4957b8a406 [1.8.x] Fixed #14497 -- Improved admin widget for "read only" FileFields
Based on patch by Adam J Forster, Paul Collins, and Julien.

Backport of 2be621e44c from master
2015-02-04 09:05:41 -05:00
Josh Schneier 16e3910e9c [1.8.x] Fixed typos of "select_related" in docs and tests.
Backport of 7d363ed432 from master
2015-02-04 07:32:34 -05:00
Aron Podrigal fc49e73648 [1.8.x] Fixed #15321 -- Honored ancestors unique checks.
Thanks to Tim for the review.

Backport of 79f27f2b61 from master
2015-02-03 18:58:48 -05:00
Tim Graham 3e24ab6f4c [1.8.x] Refactored tests that rely on an ImportError for Python 3.5 compatibility
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 c0cc8f69e7 from master
2015-02-03 18:31:17 -05:00
Simon Charette cbcf92e95f [1.8.x] Fixed #24266 -- Changed get_parent_list to return a list ordered by MRO.
Thanks to Aron Podrigal for the initial patch and Tim for the review.

Backport of 65e005f8cd from master
2015-02-03 16:41:51 -05:00
Tim Graham 92d5bedc56 [1.8.x] Reverted "Fixed #24146 -- Fixed a missing fields regression in admin checks."
This reverts commit e8171daf0c.

A new solution is forthcoming.

Backport of 0e489c19f1 from master
2015-02-03 15:24:24 -05:00
Claude Paroz ea3e40c278 [1.8.x] Fixed #24252 -- Forced lazy __str__ to utf-8 on Python 2
Thanks Stanislas Guerra for the report and Tomas Ehrlich for
the review.
Backport of cd0ceaa102 from master.
2015-02-03 18:26:08 +01:00
Matthew Somerville d88c24f436 [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse
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.
2015-02-03 18:19:06 +01:00
Anssi Kääriäinen 43b0131fb5 [1.8.x] Fixed #23617 -- Added get_pk_value_on_save()
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 8adc59038c from master
2015-02-03 09:25:55 -05:00
Tim Graham 9ffe013caa [1.8.x] Fixed #24263 -- Prevented extra queries on BaseDateDetailView with a custom queryset.
Thanks jekka-ua for the report and patch.

Backport of 118b11221f from master
2015-02-03 09:13:10 -05:00
Aymeric Augustin f87457a460 [1.8.x] Fixed #24168 -- Allowed selecting a template engine in a few APIs.
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
2015-02-03 08:32:14 +01:00
Tim Graham fe770a6452 [1.8.x] Fixed expressions test on Python 3.5; refs #23763.
Backport of 62df1834b8 from master
2015-02-01 20:11:40 -05:00
Tim Graham c9e538b174 [1.8.x] Removed threading fallback imports.
Django imports threading in many other places without fallback.

Backport of 18f3e79b13 from master
2015-02-01 18:45:01 -05:00
Tim Graham 7060ef7158 [1.8.x] Reverted "Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows."
This reverts commit da79ccca1d.

This optimized the unsuccessful case at the expense of the successful one.

Backport of 293fd5da5b from master
2015-01-30 12:52:39 -05:00
Simon Charette a301061f88 [1.8.x] Fixed #23940 -- Allowed model fields to be named `exact`.
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 eb4cdfbdd6 from master
2015-01-29 14:42:28 -05:00
Josh Smeaton 6c68e40e6e [1.8.x] Refs #14030 -- Added repr methods to all expressions
Backport of 7171bf755b from master
2015-01-28 11:03:39 +11:00
Josh Smeaton 405351ba2f [1.8.x] Refs #24060 -- Added a test demonstrating reverse order isn't mutable
Backport of f218a2ff45 from master
2015-01-28 11:03:25 +11:00
Raul Cumplido 7cc1b4710e [1.8.x] Fixed #24209 -- Prevented crash when parsing malformed RFC 2231 headers
Thanks Tom Christie for the report and review.
Backport of ac650d02cb from master.
2015-01-27 20:16:53 +01:00
Josh Smeaton e56810e839 [1.8.x] Fixed #24154 -- Backends can now check support for expressions
Backport of 8196e4bdf4 from master
2015-01-27 14:47:38 +11:00
Tomáš Ehrlich 5dff3513cc [1.8.x] Fixed #24220 - Allowed lazy objects for success_url
Backport of 511be35779 from master
2015-01-26 12:42:08 -05:00
Tim Graham 242c9538c8 [1.8.x] Fixed test_runner test failure on Python 3.5; refs #23763.
Python change is http://bugs.python.org/issue22032

Backport of 0386b97706 from master
2015-01-23 16:42:33 -05:00
Ng Zhi An 56015c01c4 [1.8.x] Fixed #24170 -- Implemented decompress for BaseRangeField widgets
Backport of 4669b6a807 from master
2015-01-23 15:07:03 -05:00
Claude Paroz bc93568500 [1.8.x] Fixed warning leak in static.serve() test
Partial forward port of b1bf8d64fb from 1.7.x. Refs #24193.
2015-01-23 09:05:46 +01:00
Andriy Sokolovskiy 11a5e45b96 [1.8.x] Fixed #24104 -- Fixed check to look on field.many_to_many instead of class instance
Backport of 38c17871bb from master
2015-01-22 18:53:47 +01:00
Loic Bistuer 0580133971 [1.8.x] Fixed small inconsistency when handling aggregate's default_alias.
Refs #14030.

Backport of d450af8a26 from master
2015-01-22 08:02:07 +07:00
Adam Taylor 45aaced91e [1.8.x] Fixed typos in code comments.
Backport of 039465a6a7 from master
2015-01-20 12:18:29 -05:00
Markus Holtermann 20f1aafa14 [1.8.x] Refs #24163 -- Fixed failing Oracle test when migrating from ForeignKey to OneToOneField
Thanks Tim Graham for review

Backport of 64ecb3f07d from master
2015-01-20 17:45:29 +01:00
Marc Tamlyn c80b2144d2 [1.8.x] Fixes #24169 -- More arrayfield specific lookups.
varchar()[] cannot compare itself to text[]

Thanks to joelburton for the patch.

Backport of 0ae94d0d31 from master
2015-01-20 10:26:32 +00:00
Josh Smeaton 504cd5d3be [1.8.x] Fixed #24183 -- Fixed wrong comparisons in Substr
Backport of 61c102d010 from master
2015-01-20 12:11:27 +11:00
Tim Graham 06fa019c1b [1.8.x] Fixed #24153 -- Fixed cookie test compatibility with Python 3.4.3+
Backport of b19b81b396 from master
2015-01-19 15:39:36 -05:00
Markus Holtermann e55cb91bd4 [1.8.x] Fixed #24163 -- Removed unique constraint after index on MySQL
Thanks Łukasz Harasimowicz for the report.

Backport of 5792e6a88c from master
2015-01-19 16:55:25 +01:00
Josh Smeaton 0c910823c1 [1.8.x] Fixed #24174 -- Fixed extra order by descending
Backport of 69c6a6868f from master
2015-01-19 13:18:09 +11:00
Tim Graham 663db8ea2a [1.8.x] Removed usage of deprecated removetags in a template test.
Backport of b84100e8e2 from master
2015-01-18 18:33:56 -05:00
Markus Holtermann 5512338d4f [1.8.x] Cleaned up migration writer tests
Backport of 65d55c4093 from master
2015-01-17 20:42:58 +01:00
Marc Tamlyn 39d95fb6ad Fixed #24092 -- Widened base field support for ArrayField.
Several issues resolved here, following from a report that a base_field
of GenericIpAddressField was failing.

We were using get_prep_value instead of get_db_prep_value in ArrayField
which was bypassing any extra modifications to the value being made in
the base field's get_db_prep_value. Changing this broke datetime
support, so the postgres backend has gained the relevant operation
methods to send dates/times/datetimes directly to the db backend instead
of casting them to strings. Similarly, a new database feature has been
added allowing the uuid to be passed directly to the backend, as we do
with timedeltas.

On the other side, psycopg2 expects an Inet() instance for IP address
fields, so we add a value_to_db_ipaddress method to wrap the strings on
postgres. We also have to manually add a database adapter to psycopg2,
as we do not wish to use the built in adapter which would turn
everything into Inet() instances.

Thanks to smclenithan for the report.
2015-01-16 16:15:16 -05:00
Collin Anderson e8171daf0c Fixed #24146 -- Fixed a missing fields regression in admin checks.
This allows using get_field() early in the app loading process.

Thanks to PirosB3 and Tim Graham.
2015-01-16 14:47:09 -05:00
Claude Paroz b4ac232907 Fixed #24099 -- Removed contenttype.name deprecated field
This finsishes the work started on #16803.
Thanks Simon Charette, Tim Graham and Collin Anderson for the
reviews.
2015-01-16 20:21:34 +01:00
Collin Anderson 5338ff4808 Fixed #24160 -- Fixed model_regress test on Windows; refs #24007. 2015-01-16 11:59:08 -05:00
Tim Graham 28db4af80a Fixed #24135 -- Made RenameModel rename many-to-many tables.
Thanks Simon and Markus for reviews.
2015-01-15 20:34:33 -05:00
Yang Liu 3f9ec12d9c Fixed #23712 -- Fixed KeyError with BaseForm._html_output() 2015-01-15 20:19:53 -05:00
Collin Anderson faf0d66a80 Fixed #23850 -- Fixed a migrations test failure on Mac OS X & Python 3 2015-01-15 19:45:43 -05:00
Michał Modzelewski 39b58ad95a Fixed #24148 -- Documented a bug with case expressions in SQLite < 3.7.0 2015-01-15 19:42:05 -05:00
Collin Anderson 67dbc56ec8 Made an expressions_case test work without Pillow. 2015-01-15 14:02:58 -05:00