Commit Graph

2015 Commits

Author SHA1 Message Date
Mariusz Felisiak 346b46a274 [1.11.x] Fixed #28378 -- Fixed union() and difference() when combining with a queryset raising EmptyResultSet.
Thanks Jon Dufresne for the report. Thanks Tim Graham and Simon Charette
for the reviews.

Backport of ca74e56350 from master
2017-07-10 20:50:50 +02:00
Tim Graham 31d7fc8541 [1.11.x] Refs #23853 -- Updated sql.query.Query.join() docstring.
Follow up to ab89414f40.

Backport of 7acbe89cc2 from master
2017-06-13 14:17:45 -04:00
Mariusz Felisiak 44e29ea1e9 [1.11.x] Fixed #28293 -- Fixed union(), intersection(), and difference() when combining with an EmptyQuerySet.
Thanks Jon Dufresne for the report and Tim Graham for the review.

Backport of 82175ead72 from master
2017-06-13 08:33:26 +02:00
Jon Dufresne ccb8297eee [1.11.x] Fixed #28282 -- Fixed class-based indexes name for models that only inherit Model.
Backport of 0c3c37a376 from master
2017-06-08 09:47:18 -04:00
Adam Johnson b7d6077517 [1.11.x] Fixed #28269 -- Fixed Model.__init__() crash on models with a field that has an instance only descriptor.
Regression in d2a26c1a90.

Backport of ed244199c7 from master
2017-06-05 09:15:55 -04:00
Manatsawin Hanmongkolchai 110bd82038 [1.11.x] Fixed #28242 -- Moved ImageField file extension validation to the form field.
Backport of a0c07d77fc from master
2017-06-01 10:44:47 -04:00
Tim Graham 9b9a81024a [1.11.x] Fixed #28199 -- Fixed Subquery generating unnecessary/invalid CAST.
Thanks Simon Charette for the fix.

Backport of f04495521a from master
2017-05-30 06:41:50 -04:00
Alex b9abdd92ab [1.11.x] Fixed #28222 -- Allowed settable properties in QuerySet.update_or_create()/get_or_create() defaults.
Backport of 37ab3c3f9d from master
2017-05-27 13:01:38 -04:00
Tim Graham f2b8fa1763 [1.11.x] Fixed #28210 -- Fixed Model._state.adding on MTI parent model after saving child model.
Regression in 38575b007a.

Backport of 59ab1b2683 from master
2017-05-19 21:09:42 -04:00
Tim Graham 74b0837bef [1.11.x] Fixed #28188 -- Fixed crash when pickling model fields.
Regression in d2a26c1a90.

Thanks Adam Alton for the report and test, and Adam Johnson for
suggesting the fix.

Backport of a9874d48b1 from master
2017-05-11 21:05:05 -04:00
François Freitag 6a2624286b [1.11.x] Fixed #28062 -- Added a setting to disable server-side cursors on PostgreSQL.
When a connection pooler is set up in transaction pooling mode, queries
relying on server-side cursors fail. The DISABLE_SERVER_SIDE_CURSORS
setting in DATABASES disables server-side cursors for this use case.

Backport of 88336fdbb5 from master
2017-05-06 07:45:46 -04:00
Tim Graham f9a4593376 [1.11.x] Fixed #28175 -- Fixed __in lookups on a foreign key when using the foreign key's parent model as the lookup value.
Thanks Simon Charette for review.

Backport of d66378a8b2 from master
2017-05-05 18:36:09 -04:00
François Freitag c679ac0449 [1.11.x] Fixed #27554 -- Fixed prefetch_related() crash when fetching relations in nested Prefetches.
Backport of c0a2b9508a from master
2017-05-04 09:55:35 -04:00
Tim Graham f3217ab596 [1.11.x] Fixed #28166 -- Fixed Model._state.db on MTI parent model after saving child model.
Regression in 38575b007a.

Backport of 584e10c76e from master
2017-05-03 12:31:18 -04:00
Simon Charette 0ad1693494 [1.11.x] Fixed #28101 -- Fixed a regression with nested __in subquery lookups and to_field.
Thanks Kristian Klette for the report and Tim for the help.

Backport of 8ef35468b6 from master
2017-04-23 01:16:04 -04:00
François Freitag 56746fb21f [1.11.x] Fixed #28091 -- Re-raised original exception when closing cursor cleanup fails 2017-04-20 17:43:39 +02:00
Claude Paroz 61e883c7c2 [1.11.x] Fixed #28096 -- Allowed prefetch calls with ModelIterable subclasses
Regression in 7ec330eeb9.
Thanks Tim Graham for the review.
Backport of 43b4a1618e from master.
2017-04-19 19:37:13 +02:00
Tim Graham 8a13cddc26 [1.11.x] Fixed #28047 -- Fixed QuerySet.filter() crash when it uses the name of a OneToOneField pk.
Regression in 1bc249c2a6.

Backport of fce7827101 from master
2017-04-10 11:52:10 -04:00
Sergey Fedoseev 8484cf4cd0 [1.11.x] Refs #18247 -- Fixed SQLite QuerySet filtering on decimal result of Least and Greatest.
Backport of 068d75688f from master
2017-03-30 08:47:16 -04:00
Tim Graham d476fa96ac [1.11.x] Refs #18974 -- Added stacklevel for permalink() deprecation.
Backport of b59c0d722d from master
2017-03-28 18:01:21 -04:00
Kapil Garg a8c540accc [1.11.x] Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices.
Backport of 7e09fa7f51 from master
2017-03-23 13:56:45 -04:00
Tim Graham e5880516f9 [1.11.x] Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models.
Thanks Markus Holtermann for review.

Backport of 3d19d1428a from master
2017-03-21 11:32:43 -04:00
Mads Jensen 0b93a992e5 [1.11.x] Fixed #27935 -- Fixed crash with BrinIndex name > 30 characters.
Backport of 82bb4e684f from master
2017-03-18 08:48:17 -04:00
Mads Jensen c654ead898
[1.11.x] Used constant instead of hard-coded value for max index name length
Refs #26709

Backport of e7033e00f8 from master
2017-03-14 15:55:07 +01:00
Matthew Schinckel 2864bb3ba6 [1.11.x] Fixed #27862 -- Fixed incorrectly quoted table aliases in Subquery SQL.
Add aliases from resolved querysets to the parent query's external
aliases to prevent those aliases from being quoted.

Thanks to Vasily Stepanov for the report and Tim Graham for the review.

Backport of f48bc7c3db from master
2017-03-01 08:21:12 -05:00
Alexey Rogachev 447c6802f0 [1.11.x] Fixed typo in DurationField's docstring.
Backport of c743af82cf from master
2017-02-20 08:45:01 -05:00
Vytis Banaitis eedf276ed1 [1.11.x] Fixed #27828 -- Fixed a crash when subtracting Integer/DurationField from DateField on Oracle/PostgreSQL.
Backport of d5088f838d from master
2017-02-16 12:35:40 -05:00
Tim Graham eeb28f4751 [1.11.x] Fixed #27742 -- Reverted "Fixed #24607 -- Serialized natural keys in multi-table inheritance models."
This reverts commit 74a575eb72 as it causes
unexpected migrations and doesn't seem to be the best solution.

Backport of 0595bca221 from master
2017-02-11 06:40:30 -05:00
ClairePhila 4101b57b19 [1.11.x] Refs #27148 -- Fixed UUIDField.to_python(None) crash.
Regression in 2f9861d823.

Backport of d26413113c from master
2017-02-10 14:34:14 -05:00
Lex Berezhny d43f847847 [1.11.x] Fixed #27800 -- Fixed QuerySet.annotate(Length(...)).distinct() crash.
Backport of ac5f886c56 from master
2017-01-31 18:46:07 -05:00
Mads Jensen c94cb4f865 [1.11.x] Removed unused variables that are overwritten.
Backport of ebf34c3cdc from master
2017-01-25 09:15:36 -05:00
Mads Jensen 65e321b781 Refs #25809 -- Made a few late review comments for BrinIndex. 2017-01-16 13:23:20 -05:00
Josh Smeaton 1df89a60c5 Fixed #25307 -- Fixed QuerySet.annotate() crash with conditional expressions.
Thanks Travis Newport for the tests and Josh Smeaton for contributing
to the patch.
2017-01-16 10:03:15 -05:00
Mads Jensen 0bc59978ab Fixed #27736 -- Used decorators for lookup registration. 2017-01-16 09:22:26 -05:00
Mads Jensen e585c43be9 Fixed #25809 -- Added BrinIndex support in django.contrib.postgres.
Thanks Tim Graham and Markus Holtermann for review.
2017-01-15 13:37:18 +01:00
Matthew Schinckel 236ebe94bf Fixed #27149 -- Added Subquery and Exists database expressions.
Thanks Josh Smeaton for Oracle fixes.
2017-01-14 09:12:24 -05:00
Florian Apolloner 84c1826ded Fixed #27718 -- Added QuerySet.union(), intersection(), difference().
Thanks Mariusz Felisiak for review and Oracle assistance.
Thanks Tim Graham for review and writing docs.
2017-01-14 08:32:07 -05:00
François Freitag 6b6be692fc Refs #16614 -- Prevented database errors from being masked by cursor close.
When an error occurred during the cursor.execute statement, the cursor
is closed. This operation did not fail with client-side cursors. Now,
with server-side cursors, the close operation might fail (example
below). The original error should be raised, not the one raised by
cursor.close(), this is only clean-up code.

For example, one can attempt to create a named cursor for an invalid
query. psycopg will raise an error about the invalid query and the
server-side cursor will not be created on PostgreSQL. When the code
attempts to cursor.close(), it asks psycopg to close a cursor that was
not created. pyscopg raises a new error: psycopg2.OperationalError:
cursor "_django_curs_140365867840512_20" does not exist.
2017-01-14 07:13:00 -05:00
François Freitag f3b7c05936 Refs #16614 -- Made QuerySet.iterator() use server-side cursors on PostgreSQL.
Thanks to Josh Smeaton for the idea of implementing server-side cursors
in PostgreSQL from the iterator method, and Anssi Kääriäinen and Kevin
Turner for their previous work. Also Simon Charette and Tim Graham for
review.
2017-01-11 09:25:37 -05:00
anabelensc 1c12df4aa6 Fixed #25912 -- Added binary left/right shift operators to F expressions.
Thanks Mariusz Felisiak for review and MySQL advice.
2017-01-03 14:15:46 -05:00
Andrew Nester 69b7d4b116 Fixed #27458 -- Fixed invalid sequence/index names when using "USER"."TABLE" db_table on Oracle. 2016-12-30 17:11:12 -05:00
Mariusz Felisiak 7d14889aa3 Fixed #27615 -- Used timedeltas as arguments to Oracle database driver.
Removed unused DatabaseFeatures.driver_supports_timedeltas workaround.
2016-12-29 15:49:18 -05:00
Florian Apolloner 00c7bfadf4 Removed unused enumerate. 2016-12-29 14:55:17 +01:00
Tim Graham e3e80da7a5 Fixed #27651 -- Allowed M2M to concrete and proxy through model. 2016-12-28 12:48:17 -05:00
Peter Inglesby a4cac17200 Fixed #27498 -- Fixed filtering on annotated DecimalField on SQLite. 2016-12-24 10:38:48 -05:00
Adam Chainz 8d94d575f8 Used @cached_property in RawQuerySet. 2016-12-23 10:12:48 -05:00
Adam Chainz 6ebf8f9057 Refs #27624 -- Made QuerySet._prefetch_related_lookups immutable. 2016-12-23 09:58:22 -05:00
Andrey Kuzminov b8741c0058 Refs #18823 -- Corrected field name in an m2m manager error message. 2016-12-23 09:31:26 -05:00
Tim Graham 09a7f121b5 Removed unneeded values in NullBooleanField.formfield().
These values are duplicated in the super().
2016-12-20 07:54:54 -05:00
Adam Chainz d2a26c1a90 Optimized Model instantiation a bit.
* Avoid some unnecessary attribute lookups, e.g. access signals directly rather than from module
* Alias some repeat accesses inside the method to use the slightly faster local lookups
* Use tuple to iterate remaining kwargs as it's faster to construct
* Cache Field.get_default() to avoid running through all the logic on every call
* Use a cached list of the properties on the model class to avoid repeat isinstance() calls
2016-12-15 13:42:44 -05:00