Sergey Fedoseev
aadd3aeb2b
Avoided creating temporary lists for obtaining the first item.
2017-07-31 11:02:23 -04:00
Sergey Fedoseev
0f905e4b44
Removed unneeded TruncBase.arity.
...
Uneeded since its introduction in 2a4af0ea43
.
2017-07-31 13:42:12 +05:00
Sergey Fedoseev
38988f289f
Avoided creation of temporary sets.
2017-07-29 10:16:43 -04:00
Sergey Fedoseev
99e7bba443
Prevented query_utils.refs_expression() from looking for empty string in annotations map.
2017-07-28 08:42:52 -04:00
Mariusz Felisiak
b61d5b1991
Fixed #28371 -- Fixed Cast() with CharField if the max_length argument isn't provided.
...
Thanks Tim Graham for the review.
2017-07-27 19:36:47 +02:00
Mariusz Felisiak
8e41373c81
Allowed database backends to specify data types for Cast().
...
A small refactor ahead of refs #28371 .
2017-07-26 20:26:58 -04:00
Sergey Fedoseev
d17eaa868c
Removed obsolete references to add_to_query().
...
Support for it was removed in d3f00bd570
.
2017-07-25 07:52:05 -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
Simon Charette
76236f0db2
Stopped setting BaseExpression.copied on copy().
...
Unused since its introduction in f59fd15c49
.
2017-07-21 00:23:21 -04:00
orf
7dfe03f86d
Sorted display of options in Func.__repr__().
2017-07-20 20:51:07 -04:00
Tim Graham
487362fa8f
Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and Expression.convert_value().
...
Unused since a0d166306f
.
2017-07-20 16:30:08 -04:00
Sergey Fedoseev
37fbeb99f9
Removed unused models.DecimalField._format().
...
Unused since b3b71a0922
.
2017-07-20 09:00:18 -04:00
Sergey Fedoseev
33d453b2a7
Removed unneeded hasattr(self.rhs, 'get_compiler') checks in db/models/lookups.py.
...
Unneeded since 9ae4362bec
.
2017-07-18 08:24:01 -04:00
Mariusz Felisiak
776cee9749
Fixed #28391 -- Fixed Cast() with CharField and max_length on MySQL.
...
Thanks Tim Graham for the review.
2017-07-17 21:12:27 +02:00
Mariusz Felisiak
e5835a7cb8
Allowed Func subclasses to add kwargs to __repr__().
...
Thanks Tim Graham for the review.
2017-07-17 10:07:19 -04:00
Florian Apolloner
adab280cef
Fixed #28399 -- Fixed QuerySet.count() for union(), difference(), and intersection() queries.
2017-07-15 08:20:12 -04:00
Sergey Fedoseev
504ce3914f
Fixed #28394 -- Allowed setting BaseExpression.output_field (renamed from _output_field).
2017-07-14 21:56:01 -04:00
Sergey Fedoseev
29769a9942
Fixed #28382 -- Prevented BaseExpression._output_field from being set if _resolve_output_field() fails.
2017-07-11 08:29:08 -04:00
Mariusz Felisiak
ca74e56350
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.
2017-07-10 20:40:08 +02:00
Tim Graham
31a2af1c01
Removed useless hasattr in UpdateQuery._setup_query().
...
The if statement always evaluates to True.
2017-07-08 08:12:46 -04:00
Tim Graham
23c529a774
Removed unused Query.clone() memo kwarg.
...
Unused since 23ca3a0194
.
2017-07-07 09:29:58 -04:00
Tim Graham
686772c177
Removed unused OrderWrt.deconstruct().
2017-07-06 18:45:53 -04:00
Mariusz Felisiak
df1106a40f
Fixed #28365 -- Unified DatabaseOperations.date_interval_sql() return value with similar methods.
2017-07-06 07:37:47 -04:00
Ran Benita
b9f7dce84b
Fixed #28010 -- Added FOR UPDATE OF support to QuerySet.select_for_update().
2017-06-29 16:00:15 -04:00
Mariusz Felisiak
6e228d0b65
Fixed #28277 -- Added validation of QuerySet.annotate() and aggregate() args.
...
Thanks Tim Graham and Nick Pope for reviews.
2017-06-29 18:25:36 +02:00
Anssi Kääriäinen
f7f5edd50d
Removed obsolete Query.tables attribute.
...
Obsolete since Query.alias_map became an OrderedDict (refs #26522 ).
2017-06-29 11:09:11 -04:00
Mads Jensen
550cb3a365
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
2017-06-28 14:07:55 -04:00
Daniel Hahler
43a4835edf
Fixed #27473 -- Added DurationField support to Extract.
2017-06-28 10:10:09 -04:00
Mariusz Felisiak
3297dede7f
Fixed #28046 -- Added the db_tablespace parameter to class-based indexes.
...
Thanks Markus Holtermann and Tim Graham for reviews.
2017-06-27 21:15:15 +02:00
Mariusz Felisiak
617505ca89
Fixed #28330 -- Prevented passing positional arguments to an Index.
...
Thanks Tim Graham for the review.
2017-06-27 13:39:37 -04:00
Paulo Alvarado
c432927160
Fixed #26362 -- Fixed update of the inherited id field of an object when its parent changes.
2017-06-26 12:11:20 -04:00
Mariusz Felisiak
0f91ba1adc
Fixed #28329 -- Fixed Cast() with Big/Small/Positive/PositiveSmallIntegerField on MySQL.
2017-06-21 10:16:53 -04:00
Maciej Jaworski
dc63ad7ac0
Fixed #28319 -- Made TextField with choices use a Select widget.
2017-06-17 08:23:32 -04:00
chillaranand
fb0f987f7d
Fixed #27914 -- Added support for nested classes in Field.deconstruct()/__repr__().
2017-06-14 10:10:17 -04:00
Adam Bogdał
9f4e0fde0a
Moved common code to RelatedField.deconstruct().
2017-06-14 08:57:43 -04:00
Adam Bogdał
cd2fe829dd
Fixed #24195 -- Deconstructed the limit_choices_to option of related fields.
...
Migrations will now be created for changes to limit_choices_to.
2017-06-14 08:57:24 -04:00
Tim Graham
7acbe89cc2
Refs #23853 -- Updated sql.query.Query.join() docstring.
...
Follow up to ab89414f40
.
2017-06-13 14:16:52 -04:00
Mariusz Felisiak
82175ead72
Fixed #28293 -- Fixed union(), intersection(), and difference() when combining with an EmptyQuerySet.
...
Thanks Jon Dufresne for the report and Tim Graham for the review.
2017-06-13 08:16:16 +02:00
Tim Graham
3d0a0ecd2c
Refs #23919 -- Removed support for broken Model.__str__() in Model.__repr__().
...
Returning invalid bytestrings in __str__() is unlikely in Python 3.
2017-06-11 15:52:19 -04:00
Collin Anderson
1a49b89470
Fixed #27953 -- Added instance's pk to Model.__str__().
2017-06-09 13:42:53 -04:00
Mads Jensen
c7f6ffbdcf
Fixed #28103 -- Added quarter extract, truncation, and lookup.
...
Thanks Mariusz Felisiak, Tim Graham, and Adam Johnson for review.
2017-06-08 15:15:29 -04:00
Claude Paroz
af69f14e7b
Removed unused sql.Query.query_terms
...
Unused since 5008a4db44
.
2017-06-08 13:11:51 -04:00
Jon Dufresne
0c3c37a376
Fixed #28282 -- Fixed class-based indexes name for models that only inherit Model.
2017-06-08 09:36:12 -04:00
Tim Graham
5a52d932ef
Replaced Model._get_pk_val() with pk property.
...
Model.pk was added after _get_pk_val() and many places weren't simplified.
2017-06-05 15:20:34 -04:00
Adam Johnson
ed244199c7
Fixed #28269 -- Fixed Model.__init__() crash on models with a field that has an instance only descriptor.
...
Regression in d2a26c1a90
.
2017-06-05 08:40:43 -04:00
Jon Dufresne
2c69824e5a
Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.
2017-06-01 19:08:59 -04:00
François Freitag
edee5a8de6
Fixed #27639 -- Added chunk_size parameter to QuerySet.iterator().
2017-06-01 17:50:41 -04:00
Manatsawin Hanmongkolchai
a0c07d77fc
Fixed #28242 -- Moved ImageField file extension validation to the form field.
2017-06-01 10:13:23 -04:00
Matthias Erll
eee34ef64c
Fixed #22550 -- Prohibited QuerySet.last()/reverse() after slicing.
2017-05-31 19:34:56 -04:00
Tim Graham
f04495521a
Fixed #28199 -- Fixed Subquery generating unnecessary/invalid CAST.
...
Thanks Simon Charette for the fix.
2017-05-30 06:40:41 -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
Tom
7afb476469
Fixed #28226 -- Replaced use of str.join() with concatenation.
2017-05-27 13:59:05 -04:00
Alex
37ab3c3f9d
Fixed #28222 -- Allowed settable properties in QuerySet.update_or_create()/get_or_create() defaults.
2017-05-27 12:41:38 -04:00
Tom
bb0b6e5263
Fixed #28211 -- Prevented ORing an empty Q() from reducing query join efficiency.
2017-05-25 09:06:25 -04:00
Tim Graham
59ab1b2683
Fixed #28210 -- Fixed Model._state.adding on MTI parent model after saving child model.
...
Regression in 38575b007a
.
2017-05-19 13:22:17 -04:00
Mariusz Felisiak
99df304c85
Fixed #28206 -- Fixed RawQuerySet crash on a model with a mixed case db_column pk on Oracle.
...
Thanks Tim Graham for the review.
2017-05-18 19:11:23 +02:00
Simon Charette
4acae21846
Fixed #24254 -- 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
Tim Graham
a9874d48b1
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.
2017-05-11 21:04:52 -04:00
Simon Charette
daf2bd3efe
Fixed #28107 -- Disabled grouping of selected primary keys for unmanaged models.
...
The grouping caused an issue with database views as PostgreSQL's query planer
isn't smart enough to introspect primary keys through views. Django doesn't
support database views but documents that unmanaged models should be used to
query them.
Thanks powderflask for the detailed report and investigation.
2017-05-11 20:00:57 -04:00
Claude Paroz
a87189fc5e
Fixed #28164 -- Improved float conversions in DecimalField.to_python
...
Thanks Tim Graham and Adam Johnson for the reviews.
2017-05-09 08:40:08 +02:00
François Freitag
88336fdbb5
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.
2017-05-06 06:59:04 -04:00
Tim Graham
d66378a8b2
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.
2017-05-05 18:35:08 -04:00
François Freitag
c0a2b9508a
Fixed #27554 -- Fixed prefetch_related() crash when fetching relations in nested Prefetches.
2017-05-04 09:17:29 -04:00
Tim Graham
584e10c76e
Fixed #28166 -- Fixed Model._state.db on MTI parent model after saving child model.
...
Regression in 38575b007a
.
2017-05-03 12:14:15 -04:00
Simon Charette
9ae4362bec
Refs #16187 -- Stopped compiling query compilers during lookup rhs processing.
...
Lookup right hand side processing was compiling query compilers which happened
to work by chance as SQLCompiler defines a as_sql() method with two optional
parameters albeit it doesn't expect the same type of arguments.
2017-05-01 00:41:21 -04:00
Simon Charette
eb4724a063
Reverted "Refs #20939 -- Moved subquery ordering clearing optimization to the __in lookup."
...
This reverts commit e62ea0bb9c
since it
broke multi-column __in lookups and _meta.order_wrt on Oracle.
2017-04-28 09:30:35 -04:00
Simon Charette
e62ea0bb9c
Refs #20939 -- Moved subquery ordering clearing optimization to the __in lookup.
...
Queries could potentially be resolved in cases where ordering matter.
2017-04-27 16:58:08 -04:00
Jon Dufresne
7be94e0335
Replaced set |= operator with update() to avoid temporary set.
2017-04-27 08:16:19 -04:00
Claude Paroz
301de774c2
Refs #27795 -- Replaced many force_text() with str()
...
Thanks Tim Graham for the review.
2017-04-27 09:10:02 +02:00
Simon Charette
c9159a082e
Refs #20939 -- Removed the Query._prepare_as_filter_value() hack.
2017-04-25 23:43:33 -04:00
Simon Charette
ec50937bcb
Refs #20939 -- Removed the Query._forced_pk hack.
2017-04-25 23:43:33 -04:00
Carles Pina Estany
9f2e8b5bb7
Fixed #28120 -- Checked that CharField.max_length is not a boolean.
2017-04-24 18:49:31 -04:00
Simon Charette
8ef35468b6
Fixed #28101 -- 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
Claude Paroz
43b4a1618e
Fixed #28096 -- Allowed prefetch calls with ModelIterable subclasses
...
Regression in 7ec330eeb9
.
Thanks Tim Graham for the review.
2017-04-19 19:32:46 +02:00
Sergey Fedoseev
e7afef13f5
Fixed #26788 -- Fixed QuerySet.update() crash when updating a geometry to another one.
2017-04-10 13:26:26 -04:00
Mariusz Felisiak
054a44d6f0
Used NotSupportedError instead of DatabaseError in SQLCompiler.as_sql().
2017-04-10 12:49:27 -04:00
Tim Graham
fce7827101
Fixed #28047 -- Fixed QuerySet.filter() crash when it uses the name of a OneToOneField pk.
...
Regression in 1bc249c2a6
.
2017-04-10 09:51:51 -04:00
Ingo Klöcker
c4536c4a54
Fixed #27777 -- Made File.open() work with the with statement ( #8310 )
...
Fixed #27777 -- Made File.open() work with the with statement
2017-04-07 14:21:06 +02:00
Mariusz Felisiak
695d4dd790
Fixed #23147 -- Disabled a limit/offset on a query with select_for_update on Oracle.
...
Thanks Shai Berger and Tim Graham for the reviews.
2017-04-07 14:08:07 +02:00
Adam Johnson
7f8a924b45
Refs #27834 -- Removed Value wrapping from StrIndex's substring param.
2017-04-03 08:39:57 -04:00
Sergey Fedoseev
bde86ce9ae
Fixed #25605 -- Made GIS DB functions accept geometric expressions, not only values, in all positions.
2017-04-01 09:47:49 -04:00
Sergey Fedoseev
068d75688f
Refs #18247 -- Fixed SQLite QuerySet filtering on decimal result of Least and Greatest.
2017-03-29 13:29:53 -04:00
Mariusz Felisiak
1d070d027c
Fixed #25414 -- Fixed QuerySet.annotate() with pk in values() on MySQL.
...
Thanks Tim Graham and Simon Charette for the reviews.
2017-03-29 06:47:07 +02:00
Tim Graham
b59c0d722d
Refs #18974 -- Added stacklevel for permalink() deprecation.
2017-03-28 17:58:10 -04:00
Mads Jensen
ed0cbc8d8b
Refs #23919 -- Removed some Python 2 compatibility code and comments.
2017-03-27 13:12:27 -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
Kapil Garg
7e09fa7f51
Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices.
2017-03-23 13:22:04 -04:00
Sergey Fedoseev
40ffabe8dc
Removed unneeded Value wraps in Substr.
...
Unneeded since e2d6e14662
.
2017-03-23 10:50:56 -04:00
Tim Graham
3d19d1428a
Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models.
...
Thanks Markus Holtermann for review.
2017-03-21 10:53:21 -04:00
Mads Jensen
19b8ca5824
Removed unused connector parameter of Query.build_filter().
...
Unused since 6fe2b001db
.
2017-03-18 09:04:56 -04:00
Mads Jensen
e45633086c
Removed unused rest_of_lookups parameter of Query.try_transform().
...
Unused since 534aaf56f4
.
2017-03-18 09:00:59 -04:00
Mads Jensen
82bb4e684f
Fixed #27935 -- Fixed crash with BrinIndex name > 30 characters.
2017-03-18 08:12:10 -04:00
Brad Melin
b625907a79
Fixed #27834 -- Added StrIndex database function.
2017-03-14 19:58:56 -04:00
Mads Jensen
e7033e00f8
Used constant instead of hard-coded value for max index name length
...
Refs #26709
2017-03-14 15:50:37 +01:00
Adam Chainz
a452dddb25
Fixed #27904 -- Added a system check that Field.validators are callable.
2017-03-11 12:27:29 -05:00
Adam Johnson
af121b08e8
Refs #27624 -- Made many attributes of Query immutable.
2017-03-08 09:25:44 -05:00
Bo Marchman
9bbb6e2d25
Fixed #26522 -- Fixed a nondeterministic AssertionError in QuerySet combining.
...
Thanks Andrew Brown for the test case.
2017-03-06 13:40:17 -05:00
Claude Paroz
8346680e1c
Refs #27795 -- Removed unneeded force_text calls
...
Thanks Tim Graham for the review.
2017-03-04 18:18:21 +01:00
Matthew Schinckel
f48bc7c3db
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.
2017-03-01 07:56:37 -05:00
Anton Samarchyan
60e52a047e
Refs #27656 -- Updated django.db docstring verbs according to PEP 257.
2017-02-28 09:17:27 -05:00