Commit Graph

96 Commits

Author SHA1 Message Date
Mariusz Felisiak 4f6a51dfe6
Fixed lookup.tests.LookupTests.test_exclude() on PostgreSQL 16 beta 1.
Order doesn't matter for this test, and on PostgreSQL 16 "%" is ordered
before "_", so switch to sort by "pub_date".
2023-06-06 11:38:23 +02:00
Mariusz Felisiak 1586a09b79
Fixed #34544 -- Avoided DBMS_LOB.SUBSTR() wrapping with IS NULL condition on Oracle.
Regression in 09ffc5c121.

Thanks Michael Smith for the report.

This also reverts commit 1e4da43955.
2023-05-08 19:34:30 +02:00
Simon Charette 0e1aae7a5f Fixed #34450 -- Fixed multi-valued JOIN reuse when filtering by expressions.
Thanks Roman Odaisky for the report.
2023-04-04 14:35:21 +02:00
Mariusz Felisiak 996c802229
Fixed #34443 -- Fixed filtering by transforms on reverse relations.
Regression in ce6230aa97.
2023-03-28 21:03:24 +02:00
Mariusz Felisiak 3afdc9e9b4
Refs #29799 -- Added field instance lookups to suggestions in FieldErrors.
Bug in cd1afd553f.
2023-03-28 19:18:48 +02:00
Ekaterina Vahrusheva 55bcbd8d17 Fixed #34378 -- Made QuerySet.in_bulk() not clear odering when id_list is passed.
This reverts 340eaded4e.
2023-03-03 06:00:10 +01:00
Mariusz Felisiak 3b24a3fa33
Removed unnecessary commas in tests. 2022-12-21 11:41:29 +01:00
Mariusz Felisiak 1e4da43955
Fixed lookup.tests.LookupTests.test_exact_none_transform() test on Oracle.
NulledTransform doesn't return TextField anymore so it cannot be
wrapped with DBMS_LOB.SUBSTR().

Test regression in 09ffc5c121.
2022-12-16 12:24:49 +01:00
Gregor Gärtner f0c06f8ab7 Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual().
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-08 08:07:38 +02:00
Mariusz Felisiak d795259ea9
Replaced assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate.
Follow up to 3f7b327562.
2022-10-07 13:05:35 +02:00
Mariusz Felisiak ce6230aa97
Fixed #34015 -- Allowed filtering by transforms on relation fields. 2022-09-22 00:17:04 +02:00
David Wobrock 9f55489529 Fixed #33705 -- Fixed crash when using IsNull() lookup in filters.
Thanks Florian Apolloner for the report.
Thanks Simon Charette for the review.
2022-05-19 07:02:22 +02:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Roman 407fe95cb1 Fixed #32691 -- Made Exact lookup on BooleanFields compare directly to a boolean value on MySQL.
Performance regression in 37e6c5b79b.

Thanks Todor Velichkov for the report.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-11-02 21:30:21 +01:00
Ian Foote f42ccdd835 Fixed #27021 -- Allowed lookup expressions in annotations, aggregations, and QuerySet.filter().
Thanks Hannes Ljungberg and Simon Charette for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-09 11:43:06 +02:00
saeedblanchette d3d95d645f Refs #24121 -- Added __repr__() to Lookup. 2021-05-24 07:32:25 +02:00
Simon Charette 170b006ce8 Fixed #32673 -- Fixed lookups crash when comparing against lookups on PostgreSQL.
Regression in 3a505c70e7.

Nonlitteral right-hand-sides of lookups need to be wrapped in
parentheses to avoid operator precedence ambiguities.

Thanks Charles Lirsac for the detailed report.
2021-04-23 15:38:32 +02:00
Mariusz Felisiak ba9a2b7544
Refs #32508 -- Raised TypeError instead of using "assert" on unsupported operations for sliced querysets. 2021-03-10 09:16:28 +01:00
Mariusz Felisiak 396da8b94c Refs #30841 -- Made isnull lookup raise ValueError for non-boolean values.
Per deprecation timeline.
2021-01-14 17:50:04 +01:00
Hasan Ramezani 3f7b327562 Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.
This also replaces assertQuerysetEqual() to
assertSequenceEqual()/assertCountEqual() where appropriate.

Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-11-06 09:24:50 +01:00
Simon Charette bbf141bcdc Refs #27149 -- Fixed sql.Query identity.
By making Query subclass BaseExpression in
3543129822 the former defined it's
identity based off _construct_args which is not appropriate.
2020-10-28 07:21:53 +01:00
Kaustubh b9be11d442 Fixed #31918 -- Allowed QuerySet.in_bulk() to fetch on a single distinct field. 2020-08-26 09:43:39 +02:00
Adam Johnson 5776a1660e Fixed #31667 -- Made __in lookup ignore None values. 2020-06-11 12:12:26 +02:00
Mariusz Felisiak 555e3a848e
Removed unused __str__() methods in tests models.
Follow up to 6461583b6c.
2020-04-30 09:13:23 +02:00
Hannes Ljungberg 447980e72a Fixed #31500 -- Fixed detecting of unique fields in QuerySet.in_bulk() when using Meta.constraints.
Detection of unique fields now takes into account non-partial unique
constraints.
2020-04-23 08:07:08 +02:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
André Ericson 31174031f1 Fixed #30841 -- Deprecated using non-boolean values for isnull lookup. 2019-10-21 08:44:20 +02:00
James Timmins 0719edcd5f Fixed #30771 -- Fixed exact lookup against queries with selected columns.
Use pre-existing select fields (and thereby GROUP BY fields) from
subquery if they were specified, instead of always defaulting to pk.

Thanks Aur Saraf for the report and Simon Charette for guidance.
2019-09-20 10:42:14 +02:00
Simon Charette 8b4a43dda7 Fixed #29545 -- Fixed using filter lookups againts nested subquery expressions.
Made sql.Where resolve lhs of its child nodes. This is necessary to
allow filter lookups against nested subquery expressions to properly
resolve their OuterRefs to Cols.

Thanks Oskar Persson for the simplified test case.
2019-08-17 11:24:35 +02:00
Simon Charette f7e9db14bb Refs #25367 -- Added test for Exists() lookup rhs. 2019-08-12 09:39:26 +02:00
Simon Charette 514104cf23 Refs #29396, #30494 -- Reduced code duplication in year lookups. 2019-05-21 07:25:09 +02:00
JangHyukJin 0027ca76c7 Used QuerySet.bulk_create() in lookup.tests. 2019-04-01 10:46:28 +02:00
Sergey Fedoseev 1933e56eca Removed uneeded generator expressions and list comprehensions. 2019-02-09 09:18:48 -05:00
Simon Charette 84e7a9f4a7 Switched setUp() to setUpTestData() where possible in Django's tests. 2018-11-27 09:35:17 -05:00
Abhinav Patil bf01994a5c Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup error. 2018-10-01 19:03:10 -04:00
Nick Pope b0fbfae093 Fixed #29503 -- Made __in lookup keep order of values in query.
Regression in 86eccdc8b6.
2018-06-20 09:29:06 -04:00
Dmitry Dygalo c979c0a2b8 Fixed #25718 -- Made a JSONField lookup value of None match keys that have a null value. 2018-04-04 10:53:46 -04:00
Mariusz Felisiak ba3078c92d Refs #29155 -- Fixed LookupTests.test_pattern_lookups_with_substr() crash on Oracle.
Test introduced in feb683c4c2 revealed
unexpected behavior on Oracle that allows concatenating NULL with string.
2018-03-15 09:54:24 -04:00
Mariusz Felisiak feb683c4c2
Fixed #29155 -- Fixed crash when database functions are used with pattern lookups.
Thanks Tim Graham and Sergey Fedoseev for reviews.
2018-03-14 10:00:07 +01:00
Raymond Hettinger aba9763b51 Refs #28814 -- Imported from collections.abc to fix Python 3.7 deprecation warnings.
https://bugs.python.org/issue25988
2018-02-05 11:42:47 -05:00
Mariusz Felisiak 83a36ac49a
Removed unnecessary trailing commas and spaces in various code. 2017-12-28 21:07:29 +01:00
Tim Graham 1b73ccc4bf Fixed #28497 -- Restored the ability to use sliced QuerySets with __exact.
Regression in ec50937bcb.

Thanks Simon Charette for review.
2017-10-16 13:56:38 -04:00
Srinivas Reddy Thatiparthy 0d3f567a7a Corrected YearComparisonLookup.get_bound() signature. 2017-09-04 10:17:51 -04:00
Sergey Fedoseev 58da81a5a3 Fixed #27985 -- Fixed query for __exact=value when get_prep_value() converts value to None.
Also fixed crash of .filter(field__transform=None).
2017-07-31 15:34:07 -04:00
Sergey Fedoseev 0baea920c8 Fixed #28453 -- Made __exact=None lookup use transforms. 2017-07-31 13:31:04 -04:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Tom Carrick 3159ad4df6 Fixed #27970 -- Allowed QuerySet.in_bulk() to fetch on fields besides primary key. 2017-07-21 08:34:35 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Mariusz Felisiak 1b6f05e91f Fixed #21160 -- Fixed QuerySet.in_bulk() crash on SQLite when requesting more than 999 ids.
Thanks Andrei Picus and Anssi Kääriäinen for the initial patch
and Tim Graham for the review.
2017-03-27 18:43:40 +02:00