1
0
mirror of https://github.com/django/django.git synced 2025-01-15 12:52:31 +00:00

173 Commits

Author SHA1 Message Date
Simon Charette
156a2138db Refs #30446 -- Removed unnecessary Value(..., output_field) in docs and tests. 2020-07-15 10:58:38 +02:00
Simon Charette
1e38f1191d Fixed #30446 -- Resolved Value.output_field for stdlib types.
This required implementing a limited form of dynamic dispatch to combine
expressions with numerical output. Refs #26355 should eventually provide
a better interface for that.
2020-07-15 10:58:29 +02:00
Simon Charette
f783a99072 Refs #25425 -- Allowed unresolved Value() instances to be compiled.
Previously unresolved Value() instances were only allowed to be
compiled if they weren't initialized with an output_field.

Given the usage of unresolved Value() instances is relatively common in
as_sql() overrides it's less controversial to add explicit support for
this previously undefined behavior now and revisit whether or not it
should be deprecated in the future.
2020-07-14 07:20:20 +02:00
Sergey Fedoseev
9d519d3dc4 Fixed #31755 -- Made temporal subtraction resolve output field. 2020-07-01 23:02:27 +02:00
Sergey Fedoseev
ed6b14d459
Refs #28621 -- Fixed crash of annotations with nested OuterRef. 2020-07-01 11:01:46 +02:00
Sergey Fedoseev
dd5aa8cb5f Fixed #28925 -- Fixed durations-only expressions crash on SQLite and MySQL.
This removes also unused DatabaseOperations.date_interval_sql().
2020-06-30 07:04:55 +02:00
Mariusz Felisiak
aeb8996a67 Fixed #31659 -- Made ExpressionWrapper preserve output_field for combined expressions.
Regression in df32fd42b84cc6dbba173201f244491b0d154a63.

Thanks Simon Charette for the review.
2020-06-12 07:20:06 +02:00
Thodoris Sotiropoulos
df32fd42b8 Fixed #31651 -- Made ExpressionWrapper use grouping columns from wrapped expression. 2020-06-03 07:29:41 +02:00
Mariusz Felisiak
a125da6a7c Fixed #31607 -- Fixed evaluated Subquery equality.
Regression in 691def10a0197d83d2d108bd9043b0916d0f09b4.
2020-05-19 22:44:57 +02:00
Nick Pope
8f10ceaa90 Changed '%s' % value pattern to str(value). 2020-05-04 08:27:18 +02:00
Mariusz Felisiak
555e3a848e
Removed unused __str__() methods in tests models.
Follow up to 6461583b6cc257d25880ef9a9fd7e2125ac53ce1.
2020-04-30 09:13:23 +02:00
Hasan Ramezani
4237050684 Fixed #31420 -- Fixed crash when filtering subquery annotation against a SimpleLazyObject.
Thanks Simon Charette for the solution and analysis.
2020-04-06 07:11:29 +02:00
Hasan Ramezani
6fbce45b03 Fixed #31415 -- Fixed crash when nested OuterRef is used with operators or in database functions. 2020-04-04 20:16:00 +02:00
Mariusz Felisiak
ab5720ad80
Removed unnecessary assertions in ExpressionOperatorTests.
These tests don't modify Number.float field.
2020-03-25 13:12:32 +01:00
Hannes Ljungberg
f3da09df0f Fixed #31396 -- Added binary XOR operator to F expressions. 2020-03-25 10:16:30 +01:00
Rohit
486786c4c4 Fixed #31251 -- Disabled grouping by OuterRef() annotation. 2020-02-27 13:02:49 +01:00
Simon Charette
41ebe60728 Fixed #31312 -- Properly ordered temporal subtraction params on MySQL.
Regression in 9bcbcd599abac91ea853b2fe10b784ba32df043e.

Thanks rick2ricks for the report.
2020-02-27 08:50:55 +01:00
Nick Pope
335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Simon Charette
9bcbcd599a Fixed #31133 -- Fixed crash when subtracting against a subquery annotation.
The subtract_temporals() database operation was not handling expressions
returning SQL params in mixed database types.

Regression in 35431298226165986ad07e91f9d3aca721ff38ec.

Thanks Reupen Shah for the report.
2020-01-03 10:35:08 +01:00
Mariusz Felisiak
45bcc6feac
Refs #31115 -- Added test for nested subquery that references related fields.
Thanks Dmitriy Gunchenko for the report and Simon Charette for the
analysis and tests.

Regression in 5a4d7285bd10bd40d9f7e574a7c421eb21094858.

Fixed in 5a4d7285bd10bd40d9f7e574a7c421eb21094858.
2019-12-23 12:17:56 +01:00
Mariusz Felisiak
8685e764ef Fixed #30986 -- Fixed queryset crash when filtering against boolean RawSQL expressions on Oracle. 2019-11-18 08:50:09 +01:00
Min ho Kim
103a6f4307 Fixed some typos in comments and docs.
Thanks to Mads Jenson for review.
2019-10-02 15:50:46 +02:00
ElizabethU
54ea290e5b Fixed #30651 -- Made __eq__() methods return NotImplemented for not implemented comparisons.
Changed __eq__ to return NotImplemented instead of False if compared to
an object of the same type, as is recommended by the Python data model
reference. Now these models can be compared to ANY (or other objects
with __eq__ overwritten) without returning False automatically.
2019-10-01 17:58:19 +02:00
Matthew Schinckel
4137fc2efc Fixed #25367 -- Allowed boolean expressions in QuerySet.filter() and exclude().
This allows using expressions that have an output_field that is a
BooleanField to be used directly in a queryset filters, or in the
When() clauses of a Case() expression.

Thanks Josh Smeaton, Tim Graham, Simon Charette, Mariusz Felisiak, and
Adam Johnson for reviews.

Co-Authored-By: NyanKiyoshi <hello@vanille.bid>
2019-08-29 09:45:29 +02:00
Mariusz Felisiak
069bee7c12
Used skipUnlessDBFeature instead of checking vendor in test_filtering_on_annotate_that_uses_q. 2019-08-29 09:40:34 +02:00
Simon Charette
ee6e93ec87 Fixed #30628 -- 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 bc7e288ca9554ac1a0a19941302dea19df1acd21.
2019-07-10 07:46:08 +02:00
Mariusz Felisiak
a9179ab032
Fixed typo in BasicExpressionsTests.test_object_update_fk() test. 2019-06-21 12:00:42 +02:00
can
567b9928a3 Fixed #29692 -- Fixed removing ordering parts for multiline RawSQL expressions. 2019-05-03 07:37:37 +02:00
Mariusz Felisiak
12b7956fc3
Refs #25507 -- Added tests for using QuerySet.count() with a RawSQL annotation.
Fixed in 3f32154f40a855afa063095e3d091ce6be21f2c5
2019-04-19 11:40:04 +02:00
Mariusz Felisiak
2a431db0f5
Fixed #28621 -- Fixed crash of annotations with OuterRef. 2019-03-27 08:24:05 +01:00
Simon Charette
3f32154f40 Refs #30188 -- Avoided GROUP BY when aggregating over non-aggregates. 2019-03-23 10:11:41 -04:00
Simon Charette
d1e9c25162 Refs #30188 -- Prevented double annotation of subquery when aggregated over.
Thanks Can Sarıgöl for the suggested trimming approach.
2019-03-23 09:50:42 -04:00
Simon Charette
bdc07f176e Fixed #30188 -- Fixed a crash when aggregating over a subquery annotation. 2019-03-23 09:48:31 -04:00
Simon Charette
9dc367dc10 Refs #30158 -- Added alias argument to Expression.get_group_by_cols(). 2019-03-21 18:47:46 -04:00
Hasan Ramezani
741ce81a42 Fixed #29619 -- Added field names to some FieldErrors. 2019-02-14 18:58:08 -05:00
Simon Charette
9e5e5a657b Fixed #30044 -- Raised a FieldError on inherited field update attempts. 2019-01-16 14:09:51 -05:00
Simon Charette
aa5d0a5a90 Removed unnecessary transaction wrapping in expressions test. 2019-01-16 13:23:55 -05:00
Nasir Hussain
f021c110d0 Fixed #30099 -- Fixed invalid SQL when filtering a Subquery by an aggregate. 2019-01-15 07:22:59 -05:00
Simon Charette
bc05547cd8 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 2019-01-09 17:52:36 -05:00
Simon Charette
84e7a9f4a7 Switched setUp() to setUpTestData() where possible in Django's tests. 2018-11-27 09:35:17 -05:00
Tim Graham
193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Simon Charette
bc7e288ca9 Fixed #29745 -- Based Expression equality on detailed initialization signature.
The old implementation considered objects initialized with an equivalent
signature different if some arguments were provided positionally instead of
as keyword arguments.

Refs #11964, #26167.
2018-10-02 19:15:20 -04:00
Mariusz Felisiak
7b159df942 Fixed expressions tests when run in reverse.
Regression in e7a0a5c8b21f5ad1a0066bd0dfab84466b474e15.
2018-09-18 15:58:20 -04:00
Mariusz Felisiak
e7a0a5c8b2
Simplified expressions.tests. 2018-09-13 22:12:21 +02:00
Srinivas Reddy Thatiparthy
34d6bceec4 Fixed #29500 -- Fixed SQLite function crashes on null values.
Co-authored-by: Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2018-09-10 15:08:55 -04:00
Alexander Holmbäck
f315d0423a Fixed #29727 -- Made nonexistent joins in F() raise FieldError.
Regression in 2162f0983de0dfe2178531638ce7ea56f54dd4e7.
2018-09-08 09:40:33 -04:00
Alexander Holmbäck
aa16ec5474 Moved test for nonexistent field in F() to BasicExpressionsTest. 2018-09-08 09:21:57 -04:00
Daniel Miller
60156750f6 Fixed #29330 -- Fixed crash when pickling BaseExpression.
Regression in cfff2af02be40106d4759cc6f8bfa476ce82421c.
2018-04-16 10:15:13 -04:00
Mariusz Felisiak
362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Simon Charette
277ed07209 Fixed #29195 -- Fixed Exists.output_field resolution on single-valued queries.
The Subquery class which Exists inherits from defaulted to using single-valued
querie's field if no output_field was explicitly specified on initialization
which was bypassing the Exists.output_field defined at the class level.

Moving Subquery's dynamic output_field resolution to _resolve_output_field
should make sure the fallback logic is only performed if required.

Regression in 08654a99bbdd09049d682ae57cc94241534b29f0.

Thanks Oli Warner for the detailed report.
2018-03-08 13:30:41 -05:00