Commit Graph

191 Commits

Author SHA1 Message Date
Tim Graham 73be11a266
Removed an obsolete query test that assumes serial pks.
The code from the original fix (922aba3def)
was removed in 419de7b00d.
2020-10-27 06:31:26 +01:00
Kwist 981a072dd4 Fixed -- Fixed pickling named values from QuerySet.values_list(). 2020-09-16 13:43:06 +02:00
Mariusz Felisiak e11d05e0b4
Fixed -- Fixed QuerySet.ordered for GROUP BY queries on models with Meta.ordering.
Regression in 0ddb4ebf7b.

Thanks Julien Dutriaux for the report.
2020-09-14 20:07:44 +02:00
Hasan Ramezani 9c9a3fe118 Fixed -- Fixed crash when filtering againts "negate" field.
Thanks Simon Charette for the initial patch.
2020-07-29 08:20:58 +02:00
Jacob Walls 512da9d585 Fixed -- Fixed QuerySet.exclude() when rhs is a nullable column. 2020-07-06 10:15:37 +02:00
Nicolas Baccelli b38d44229f Fixed -- Reallowed using non-expressions having filterable attribute as rhs in queryset filters.
Regression in 4edad1ddf6.
2020-06-08 08:17:23 +02:00
Simon Charette 94f63b926f Refs -- Relied on setUpTestData() test data isolation in various tests. 2020-05-15 20:22:56 +02:00
Simon Charette 1dd96f731d Refs -- Adjusted a test to avoid making a shared test model unpickable.
This allowed the Note model to be used in setUpTestData() which requires
assigned model instances to be copy.deepcopy()'able.
2020-05-15 20:22:51 +02:00
Simon Charette 513948735b Fixed -- Added proper field validation to QuerySet.order_by().
Resolve the field reference instead of using fragile regex based string
reference validation.
2020-04-06 10:19:49 +02:00
Simon Charette 98ea4f0f46 Refs -- Deprecated passing raw column aliases to order_by().
Now that order_by() has expression support passing RawSQL() can achieve
the same result.

This was also already supported through QuerySet.extra(order_by) for
years but this API is more or less deprecated at this point.
2020-04-06 10:01:02 +02:00
Jon Dufresne e649d691f8 Removed unnecessary parentheses in various code. 2019-11-18 15:25:59 +01:00
Simon Charette 13a8884a08 Fixed -- Fixed exclusion of multi-valued lookup against outer rhs.
OuterRef right hand sides have to be nested, just like F rhs have to,
during the subquery pushdown split_exclude performs to ensure they are
resolved against the outer query aliases.
2019-09-02 10:52:36 +02:00
Diederik van der Boor 25f21bd237 Fixed -- Added helpful error messages for invalid AutoField/FloatField/IntegerField values.
Co-authored-by: Diederik van der Boor <vdboor@edoburu.nl>
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2019-08-05 08:41:29 +02:00
Jon Dufresne d89053585e Improved error message when index in __getitem__() is invalid. 2019-07-23 20:12:08 +02:00
Simon Charette ee6e93ec87 Fixed -- Adjusted expression identity to differentiate bound fields.
Expressions referring to different bound fields should not be
considered equal.

Thanks Julien Enselme for the detailed report.

Regression in bc7e288ca9.
2019-07-10 07:46:08 +02:00
can 325d5d6445 Fixed -- Made reverse lookup use Field.get_db_prep_value() from the target field. 2019-06-25 10:20:33 +02:00
Simon Charette 0cb4062482 Refs -- Used RecursionError instead of RuntimeError to raise nested subquery errors.
RecursionError was introduced in Python 3.5 and subclasses RuntimeError.
2019-04-15 15:20:41 +02:00
Simon Charette c0969ee227 Refs -- Based recursive nested subquery detection on sys.getrecursionlimit().
This makes sure the test_avoid_infinite_loop_on_too_many_subqueries test
doesn't fail on systems with a non-default recursion limit.
2019-04-15 15:20:41 +02:00
can 96446c7152
Refs -- Added test for excluding m2m intermediary table. 2019-03-30 14:46:59 +01:00
Mariusz Felisiak 9ab1d55596
Refs -- Added test for excluding circular related fields with F() expression.
Fixed in f19a4945e1.
2019-03-28 07:10:54 +01:00
Simon Charette f19a4945e1 Fixed -- Fixed a crash when excluding a related field with a F(). 2019-03-23 09:48:28 -04:00
Simon Charette 3543129822 Refs -- Moved subquery expression resolving to Query.
This makes Subquery a thin wrapper over Query and makes sure it respects
the Expression source expression API by accepting the same number of
expressions as it returns. Refs .

It also makes OuterRef usable in Query without Subquery wrapping. This
should allow Query's internals to more easily perform subquery push downs
during split_exclude(). Refs .
2019-03-21 20:36:31 -04:00
Sergey Fedoseev 1933e56eca Removed uneeded generator expressions and list comprehensions. 2019-02-09 09:18:48 -05:00
Nick Pope 24b82cd201 Fixed -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
2019-02-06 13:48:39 -05:00
Tim Graham 193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Ian Foote e1fc07c047 Fixed -- Allowed ORing (|) with sliced QuerySets. 2018-11-15 09:43:58 -05:00
Mariusz Felisiak 024abe5b82
Fixed -- Fixed crash of sliced queries with multiple columns with the same name on Oracle 12.1.
Regression in 0899d583bd.

Thanks Tim Graham for the review and Jani Tiainen for help.
2018-09-26 20:18:48 +02:00
Ramiro Morales 1b1f64ee5a Refs -- Deprecated Meta.ordering affecting GROUP BY queries.
Thanks Ramiro Morales for contributing to the patch.
2018-09-13 12:29:48 -04:00
Josh Schneier 4d48ddd8f9 Fixed -- Prevented Paginator's unordered warning on EmptyQuerySet.
Thanks carltongibson for the idea and weijunji for the initial patch.
2018-07-16 14:28:47 -04:00
Sergey Fedoseev c9088cfc7b Fixed some assertTrue() that were intended to be assertEqual(). 2018-07-09 11:13:40 -04:00
Carlton Gibson c4f099de1d
Refs -- Used quote_name for column names in tests.
Regression in a253a580e6
2018-06-06 16:13:25 +02:00
Tom Forbes a253a580e6 Refs -- Quoted MySQL column names in tests. 2018-06-05 12:13:29 +02:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Simon Charette d61fe24601 Fixed -- Fixed crash in aggregation of distinct+ordered+sliced querysets.
Regression in 4acae21846.
Thanks Stephen Brooks for the report.
2018-02-08 09:59:25 -05:00
Mariusz Felisiak 34b52f8572
Renamed the allow_sliced_subqueries database feature to allow_sliced_subqueries_with_in.
After 0899d583bd this database feature is
false only on MySQL which doesn't support sliced subqueries only with
IN/ALL/ANY/SOME.
2018-02-07 08:27:47 +01:00
Mariusz Felisiak aad1833fa0
Refs -- Added test for querying mixed case fields with common related model.
Thanks Shai Berger for the review.
2018-01-20 20:48:01 +01:00
Mariusz Felisiak 83a36ac49a
Removed unnecessary trailing commas and spaces in various code. 2017-12-28 21:07:29 +01:00
Sergey Fedoseev f3c9562143 Fixed -- Allowed QuerySet.values_list() to return a namedtuple. 2017-09-06 15:32:32 -04:00
François Freitag ad4a8acdb5 Fixed -- Added support for a list of fields in Meta.get_latest_by and QuerySet.earliest()/latest(). 2017-09-05 20:14:54 -04:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Anssi Kääriäinen f7f5edd50d Removed obsolete Query.tables attribute.
Obsolete since Query.alias_map became an OrderedDict (refs ).
2017-06-29 11:09:11 -04:00
Matthias Erll eee34ef64c Fixed -- Prohibited QuerySet.last()/reverse() after slicing. 2017-05-31 19:34:56 -04:00
Jon Dufresne 2a5708a304 Fixed a test's dict_keys/list comparison that always evaluated as False. 2017-05-27 18:37:16 -04:00
Simon Charette 4acae21846 Fixed -- Fixed queries using the __in lookup with querysets using distinct() and order_by().
Thanks Tim for the review.
2017-05-11 21:50:07 -04:00
Simon Charette 8ef35468b6 Fixed -- Fixed a regression with nested __in subquery lookups and to_field.
Thanks Kristian Klette for the report and Tim for the help.
2017-04-23 00:21:27 -04:00
Mariusz Felisiak f42c7cc87b Refs -- Replaced DatabaseFeatures.supports_1000_query_parameters by a DatabaseFeatures.max_query_params. 2017-03-24 18:37:03 +01:00
Bo Marchman 9bbb6e2d25 Fixed -- Fixed a nondeterministic AssertionError in QuerySet combining.
Thanks Andrew Brown for the test case.
2017-03-06 13:40:17 -05:00
Vytis Banaitis 3dcc351691 Refs -- Used yield from. 2017-02-23 20:06:01 -05:00
François Freitag e124d2da94 Fixed -- Fixed negated Q() queries that span relations.
Prevented queries from reusing trimmed joins.
2017-02-09 11:20:33 -05:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00