Jon Dufresne
e13cfc6dfd
Fixed #31596 -- Changed ForeignKey.validate() to use the base manager.
2020-06-25 11:36:20 +02:00
Mariusz Felisiak
82da72b748
Refs #28077 -- Added opclasses to Index.__repr__().
...
This also removes unnecessary commas between attributes.
2020-06-17 10:32:43 +02:00
Simon Charette
ea3beb4f5a
Refs #30446 -- Defined default output_field of text database functions.
...
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. SubStr(CharField, IntegerField, IntegerField)).
2020-06-16 10:08:02 +02:00
Hannes Ljungberg
7edc6e53a7
Fixed #31702 -- Added support for PostgreSQL opclasses in UniqueConstraint.
2020-06-16 07:19:00 +02:00
Sultan
6b25d24a57
Fixed #31706 -- Removed unnecessary getattr() call in FileDescriptor.__get__().
...
refresh_from_db() loads fields values.
2020-06-15 07:26:49 +02:00
Mariusz Felisiak
aeb8996a67
Fixed #31659 -- Made ExpressionWrapper preserve output_field for combined expressions.
...
Regression in df32fd42b8
.
Thanks Simon Charette for the review.
2020-06-12 07:20:06 +02:00
Adam Johnson
5776a1660e
Fixed #31667 -- Made __in lookup ignore None values.
2020-06-11 12:12:26 +02:00
alosultan
678c8dfee4
Fixed #31680 -- Removed unnecessary getattr() call in DeferredAttribute.__get__().
...
refresh_from_db() loads fields values.
2020-06-10 12:24:18 +02:00
SergBobrovsky
9bfa6a35f0
Removed unnecessary list() call in ModelBase.__new__().
...
Unnecessary since 58ad030d05
.
2020-06-10 12:10:36 +02:00
Hasan Ramezani
037a624120
Fixed #31657 -- Fixed ordering by attnames of self-referential ForeignKeys.
2020-06-10 11:14:26 +02:00
Nicolas Baccelli
b38d44229f
Fixed #31664 -- Reallowed using non-expressions having filterable attribute as rhs in queryset filters.
...
Regression in 4edad1ddf6
.
2020-06-08 08:17:23 +02:00
Mariusz Felisiak
78ad4b4b02
Fixed #31660 -- Fixed queryset crash when grouping by m2o relation.
...
Regression in 3a941230c8
.
Thanks Tomasz Szymański for the report.
2020-06-08 07:21:54 +02:00
Sasha Pachev
38a21f2d9e
Fixed #31663 -- Made DecimalField.to_python() handle non-numeric invalid values.
2020-06-05 21:13:36 +02:00
Mariusz Felisiak
f83b44075d
Refs #30913 -- Added system checks for covering indexes and unique constraints support.
2020-06-04 12:26:25 +02:00
Hannes Ljungberg
8c7992f658
Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+.
2020-06-04 12:26:22 +02:00
Thodoris Sotiropoulos
df32fd42b8
Fixed #31651 -- Made ExpressionWrapper use grouping columns from wrapped expression.
2020-06-03 07:29:41 +02:00
Simon Charette
f8ef5f2c86
Refs #21171 -- Made Collector.delete() rollback in the correct database.
...
Regression in c7dd8490b882b2cefdc7faf431dc64c532b79c9.
2020-05-29 10:24:37 +02:00
Ryan Heard
587b179d41
Fixed #31606 -- Allowed using condition with lookups in When() expression.
2020-05-27 07:32:23 +02:00
Laurent Tramoy
2aac176e86
Fixed #31614 -- Fixed aliases ordering by OrderBy() expressions of combined queryset.
2020-05-26 21:14:45 +02:00
Simon Charette
972000420e
Fixed #31624 -- Avoided subquery usage on QuerySet.all().delete().
...
Thanks Adam Johnson for the report.
Regression in 7acef095d7
.
2020-05-25 08:14:49 +02:00
Manuel Weitzman
a4e6030904
Fixed #30375 -- Added FOR NO KEY UPDATE support to QuerySet.select_for_update() on PostgreSQL.
2020-05-21 10:51:10 +02:00
Hasan Ramezani
3c7bf39e23
Fixed #31410 -- Added system checks for invalid model field names in UniqueConstraint.
2020-05-20 10:56:55 +02:00
Mariusz Felisiak
a125da6a7c
Fixed #31607 -- Fixed evaluated Subquery equality.
...
Regression in 691def10a0
.
2020-05-19 22:44:57 +02:00
Mariusz Felisiak
3a941230c8
Fixed #31584 -- Fixed crash when chaining values()/values_list() after Exists() annotation and aggregation on Oracle.
...
Oracle requires the EXISTS expression to be wrapped in a CASE WHEN in
the GROUP BY clause.
Regression in efa1908f66
.
2020-05-14 15:07:08 +02:00
Simon Charette
adfbf653dc
Fixed #31568 -- Fixed alias reference when aggregating over multiple subqueries.
...
691def10a0
made all Subquery() instances
equal to each other which broke aggregation subquery pushdown which
relied on object equality to determine which alias it should select.
Subquery.__eq__() will be fixed in an another commit but
Query.rewrite_cols() should haved used object identity from the start.
Refs #30727 , #30188 .
Thanks Makina Corpus for the report.
2020-05-14 09:31:15 +02:00
Simon Charette
42c08ee465
Fixed #31566 -- Fixed aliases crash when chaining values()/values_list() after annotate() with aggregations and subqueries.
...
Subquery annotation references must be resolved if they are excluded
from the GROUP BY clause by a following .values() call.
Regression in fb3f034f1c
.
Thanks Makina Corpus for the report.
2020-05-14 08:16:16 +02:00
Hasan Ramezani
01a381cc17
Fixed #31580 -- Added error messages on distinct() following union(), intersection(), and difference().
2020-05-13 14:44:10 +02:00
Jon Dufresne
d6aff369ad
Refs #30116 -- Simplified regex match group access with Match.__getitem__().
...
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +02:00
Adam Johnson
a8b2db1cae
Optimized Model and QuerySet pickling version comparison.
2020-05-11 09:50:11 +02:00
sage
6789ded0a6
Fixed #12990 , Refs #27694 -- Added JSONField model field.
...
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.
Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-08 07:23:31 +02:00
Mariusz Felisiak
b73e66e758
Fixed #31538 -- Fixed Meta.ordering validation lookups that are not transforms.
...
Regression in 440505cb2c
.
Thanks Simon Meers for the report.
2020-05-05 09:08:29 +02:00
Ian Foote
c226c6cb32
Fixed #20581 -- Added support for deferrable unique constraints.
2020-04-30 10:43:50 +02:00
François Freitag
abea86f9e4
Removed unnecessary tuple wrapping of single format string argument.
2020-04-27 08:30:16 +02:00
Tim Schilling
a92cc84b4a
Refs #31369 -- Deprecated models.NullBooleanField in favor of BooleanField(null=True).
2020-04-24 10:10:45 +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
Adam Johnson
67f9d076cf
Avoided unnecessary recompilation of ordering clause regex in SQLCompiler.
2020-04-22 20:28:01 +02:00
Hasan Ramezani
35a67b3731
Fixed #31474 -- Made QuerySet.delete() not return the number of deleted objects if it's zero.
2020-04-20 09:51:54 +02:00
sobolevn
578c03b276
Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet.
2020-04-15 11:26:11 +02:00
Ichlasul Affan
53d229ff63
Fixed #31351 -- Added system checks for partial indexes and unique constraints support.
2020-04-10 12:00:27 +02:00
miigotu
210657b791
Fixed #28184 -- Allowed using a callable for FileField and ImageField storage.
2020-04-08 11:26:17 +02:00
Simon Charette
1d16c5d562
Refs #27666 -- Ensured relationship consistency on delayed reloads.
...
Delayed reloads of state models broke identity based relationships
between direct and non-direct ancestors.
Basing models.Options related objects map of model labels instead of
their identity ensured relationship consistency is maintained.
Refs #30966 .
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-04-07 09:20:46 +02:00
Simon Charette
513948735b
Fixed #31426 -- 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 #7098 -- 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
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
5c24c16e68
Refs #12990 -- Moved PostgresSimpleLookup to the django.db.models.lookups.PostgresOperatorLookup.
2020-04-01 10:55:53 +02:00
Adam Johnson
c06d7c9239
Refs #31403 -- Made SQLInsertCompiler.execute_sql() always return an iterable of rows.
...
List of tuples.
2020-03-31 07:12:11 +02:00
Adam Johnson
9e1b6b8a66
Fixed #23916 -- Allowed makemigrations to handle related model name case changes.
...
Made autodetector ignore related model name case changes so unnecessary
migrations are not created.
2020-03-25 10:39:34 +01:00
Hannes Ljungberg
f3da09df0f
Fixed #31396 -- Added binary XOR operator to F expressions.
2020-03-25 10:16:30 +01:00
Hasan Ramezani
10866a10fe
Fixed #31377 -- Disabled grouping by aliases on QuerySet.values()/values_list() when they collide with field names.
...
Regression in fb3f034f1c
.
Thanks Holovashchenko Vadym for the report.
2020-03-25 09:13:46 +01:00
Hasan Ramezani
53b6a466d8
Refs #29724 -- Added is_dst parameter to QuerySet.datetimes().
...
Thanks Simon Charette for the review and Mariusz Felisiak for tests.
2020-03-20 12:55:33 +01:00
Jon Dufresne
013147fae2
Fixed #31285 -- Fixed inherited Meta.ordering of "-pk".
2020-03-19 12:57:07 +01:00
Mariusz Felisiak
5c8441a0b8
Refs #31055 -- Made long column names checks support databases aware.
2020-03-18 18:41:40 +01:00
Simon Charette
9f07f27124
Fixed #31376 -- Optimized nulls ordering when possible on SQLite and MySQL.
...
Both backends order NULLs first on ascending ordering and last on
descending ordering which makes ORDER BY IS (NOT)? NULL wasteful when
asc(nulls_first) and desc(nulls_last) are used since it prevents indice
usage.
2020-03-18 06:43:49 +01:00
Abhijeet Viswa
babd412685
Fixed #29129 -- Skipped UPDATE when adding a model instance with inherited primary key that has a default.
2020-03-05 12:08:38 +01:00
Jon Dufresne
769cee5252
Fixed #31327 -- Deprecated providing_args argument for Signal.
2020-03-05 09:38:52 +01:00
Mariusz Felisiak
7b8fa1653f
Fixed #31150 -- Included subqueries that reference related fields in GROUP BY clauses.
...
Thanks Johannes Hoppe for the report.
Regression in fb3f034f1c
.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2020-03-03 11:25:37 +01:00
Matheus Cunha Motta
e908eb6287
Fixed #31310 -- Fixed hints in checks for using intermediate model with ambiguous foreign key.
...
symmetrical=False is not required since
87b1ad6e73
.
2020-02-28 08:38:57 +01:00
Rohit
486786c4c4
Fixed #31251 -- Disabled grouping by OuterRef() annotation.
2020-02-27 13:02:49 +01:00
Valze
5bf28ac2ed
Fixed #31185 -- Fixed detecting of unique fields in ForeignKey/ForeignObject checks when using Meta.constraints.
2020-02-27 10:53:29 +01:00
Taoup
271fdab8b7
Fixed #31286 -- Made database specific fields checks databases aware.
...
Follow up to 0b83c8cc4d
.
2020-02-24 14:23:46 +01:00
Mariusz Felisiak
d270c10a72
Refs #31187 -- Added total_unique_constraints property to model's Options.
2020-02-19 09:36:19 +01:00
Carlton Gibson
a34cb5a6d4
Refs #31282 -- Clarified M2O add/remove/set with PK behaviour.
...
Improved error message for remove() and added tests.
2020-02-18 19:54:29 +01:00
Xavier Francisco
8690878507
Fixed #31277 -- Relaxed system check of m2m intermediary tables for db_table collision when database routers are installed.
...
Turned the error into a warning when database routers are installed.
2020-02-17 13:53:45 +01:00
Abhijeet Viswa
1712a76b9d
Fixed #31246 -- Fixed locking models in QuerySet.select_for_update(of=()) for related fields and parent link fields with multi-table inheritance.
...
Partly regression in 0107e3d105
.
2020-02-11 20:43:57 +01:00
Simon Charette
71756bdfed
Fixed #31055 -- Made constraint checks support databases aware.
2020-02-07 11:03:53 +01:00
Jon Dufresne
3259983f56
Fixed #31233 -- Closed database connections and cursors after use.
2020-02-06 15:35:23 +01:00
Hasan Ramezani
da79ee472d
Fixed #26813 -- Prevented empty choice in ModelChoiceField with RadioSelect for fields with blank=False.
2020-02-05 10:27:01 +01:00
Nick Pope
335c9c94ac
Simplified imports from django.db and django.contrib.gis.db.
2020-02-04 13:20:06 +01:00
Mariusz Felisiak
6b178a3e93
Fixed #31217 -- Made QuerySet.values()/values_list() group by not selected annotations with aggregations used in order_by().
...
Regression in 59b4e99dd0
.
Thanks Jon Dufresne for the report and Simon Charette for the review.
2020-02-03 07:48:11 +01:00
Adam Johnson
c1b24718e0
Cached ForeignObject.(local/foreign/reverse)_related_fields properties.
2020-01-31 14:07:52 +01:00
Hasan Ramezani
a97111eabf
Fixed 31207 -- Prevented references to non-local remote fields in ForeignKey.to_field.
...
Thanks Simon Charette for the initial patch and review.
2020-01-31 10:19:12 +01:00
Matthias Kestenholz
4e8d89020c
Fixed #31219 -- Fixed object deletion crash for nested protected related objects.
2020-01-31 09:07:58 +01:00
Taoup
efc1c73bf5
Simplified DeferredAttribute.__get__() a bit.
2020-01-29 16:06:56 +01:00
Mariusz Felisiak
b7a3a6c9ef
Used model's Options.label/label_lower where applicable.
2020-01-29 12:09:20 +01:00
Hasan Ramezani
4ca5c565f4
Refs #27852 -- Fixed object deletion to show all restricted related objects rather than just the first one.
2020-01-29 09:02:23 +01:00
Mariusz Felisiak
2a6fc89018
Refs #27852 -- Renamed a loop variable in Collector.collect() to avoid redefinition.
2020-01-29 09:02:23 +01:00
Hasan Ramezani
ab3cbd8b9a
Refs #27852 -- Fixed object deletion to show all protected related objects rather than just the first one.
...
Thanks Anton Samarchyan for the initial patch.
2020-01-27 12:21:02 +01:00
Jon Dufresne
26be703fe6
Changed re-raising an exception to use bare raise syntax where appropriate.
2020-01-20 11:44:28 +01:00
Adam Johnson
1e0dcd6c8b
Used constant instead of hard-coded value for recursive relationship.
2020-01-16 08:34:58 +01:00
Mariusz Felisiak
bf77669453
Fixed #29998 -- Allowed multiple OneToOneFields to the parent model.
...
We assumed that any OneToOneField's in a child model must be the
parent link and raised an error when parent_link=True was not
specified. This patch allows to specify multiple OneToOneField's to
the parent model.
OneToOneField's without a custom related_name will raise fields.E304
and fields.E305 so this should warn users when they try to override
the auto-created OneToOneField.
2020-01-16 08:06:16 +01:00
Carlton Gibson
29c126bb34
Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited choices.
...
Regression in 2d38eb0ab9
2020-01-15 15:35:22 +01:00
Mariusz Felisiak
59b4e99dd0
Refs #31136 -- Made QuerySet.values()/values_list() group only by selected annotation.
...
Regression in 0f843fdd5b
.
2020-01-15 09:32:42 +01:00
chetan22
63e6ee1f99
Fixed #29871 -- Allowed setting pk=None on a child model to create a copy.
...
Thanks Simon Charette and Tim Graham for the initial patch.
2020-01-15 08:28:30 +01:00
Mariusz Felisiak
6f7998adc7
Fixed #31155 -- Fixed a system check for the longest choice when a named group contains only non-string values.
...
Regression in b6251956b6
.
Thanks Murat Guchetl for the report.
2020-01-11 19:47:36 +01:00
Adam Johnson
5166097d7c
Fixed #31154 -- Added support for using enumeration types in templates.
...
Enumeration helpers are callables, so the template system tried to call
them with no arguments.
Thanks Rupert Baker for helping discover this.
2020-01-10 07:52:06 +01:00
Hasan Ramezani
eef3ea847e
Fixed #31148 -- Added error messages on update()/delete() operations following union(), intersection(), and difference().
2020-01-09 12:20:54 +01:00
Hasan Ramezani
f600e3fad6
Fixed #21238 -- Fixed restoring attributes when pickling FileField and ImageField.
2020-01-09 09:37:59 +01:00
Taoup
979f61abd3
Simplified model's Options.add_field() a bit.
2020-01-07 11:58:06 +01:00
Mariusz Felisiak
0f843fdd5b
Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().
...
Regression in fb3f034f1c
.
Thanks Sigurd Ljødal for the report.
2020-01-04 20:49:11 +01:00
Simon Charette
5779cc938a
Fixed #31071 -- Disabled insert optimization for primary keys with defaults when loading fixtures.
...
Model.save_base() is called directly when loading fixtures and assumes
existing rows will be updated. Branching of "raw" allows to maintain
the optimization introduced in #29260 while supporting this edge case.
Regression in 85458e94e3
.
Thanks Reupen Shah for the report.
2019-12-30 07:49:10 +01:00
Simon Charette
720de4d044
Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().
...
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY
references to it.
Thanks Thierry Bastian for the report and Baptiste Mispelon for the
bisect.
Regression in fb3f034f1c
.
2019-12-23 09:24:03 +01:00
Hasan Ramezani
a3fc24f014
Fixed #31095 -- Made RelatedManager.set() preserve existing m2m relations with an invalid type.
2019-12-19 13:33:05 +01:00
Simon Charette
5a4d7285bd
Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on aggregations.
...
Thanks Johannes Hoppe for the report.
Regression in fb3f034f1c
.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-19 10:04:56 +01:00
Ram Rachum
972d93a95e
Optimized containment check in ChoicesMeta.
2019-12-16 11:22:45 +01:00
Baptiste Mispelon
09341856ed
Used Signature API instead of deprecated inspect.getcallargs().
...
inspect.getcallargs() was deprecated in Python 3.5 and the Signature
API (PEP 362) has better support for decorated functions (by default,
it follows the __wrapped__ attribute set by functools.wraps for
example).
2019-12-10 09:36:34 +01:00
Mariusz Felisiak
d6505273cd
Refs #31044 -- Fixed error message when using Prefetch with a values_list() queryset.
2019-12-09 15:45:53 +01:00
Hasan Ramezani
4540842bc3
Fixed #31044 -- Errored nicely when using Prefetch with a raw() queryset.
2019-12-09 15:45:18 +01:00
Alex Aktsipetrov
723fc7fcf6
Made Query.check_filterable() use bool by default instead of str.
2019-12-06 13:52:36 +01:00
Alex Aktsipetrov
bf12273db4
Fixed #31060 -- Reallowed window expressions to be used in conditions outside of queryset filters.
...
Regression in 4edad1ddf6
.
Thanks utapyngo for the report.
2019-12-06 13:52:16 +01:00
Baptiste Mispelon
26cab4e8c1
Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept callable values in through_defaults.
2019-12-03 19:47:38 +01:00
Baptiste Mispelon
c50839fccf
Simplified RelatedManager._add_items() a bit.
...
Added early return in RelatedManager._add_items() to decrease an
indentation level.
2019-12-03 19:47:32 +01:00
Baptiste Mispelon
6c0341f127
Refs #31046 -- Added django.db.models.utils.resolve_callables().
2019-12-03 19:47:32 +01:00
Mariusz Felisiak
0107e3d105
Fixed #30953 -- Made select_for_update() lock queryset's model when using "self" with multi-table inheritance.
...
Thanks Abhijeet Viswa for the report and initial patch.
2019-12-02 07:57:19 +01:00
Simon Charette
379bf1a2d4
Fixed #8467 -- Prevented crash when adding existent m2m relation with an invalid type.
...
This was an issue anymore on backends that allows conflicts to be
ignored (Refs #19544 ) as long the provided values were coercible to the
expected type. However on the remaining backends that don't support
this feature, namely Oracle, this could still result in an
IntegrityError.
By attempting to coerce the provided values to the expected types in
Python beforehand we allow the existing value set intersection in
ManyRelatedManager._get_missing_target_ids to prevent the problematic
insertion attempts.
Thanks Baptiste Mispelon for triaging this old ticket against the
current state of the master branch.
2019-11-22 09:08:10 +01:00
Simon Charette
f97a6123c0
Refs #25367 -- Made Query.build_filter() raise TypeError on non-conditional expressions.
2019-11-21 11:56:35 +01:00
Simon Charette
e9a0e1d4f6
Fixed #30484 -- Added conditional expressions support to CheckConstraint.
2019-11-21 11:56:35 +01:00
Simon Charette
37e6c5b79b
Refs #25367 -- Moved conditional expression wrapping to the Exact lookup.
2019-11-21 11:56:35 +01:00
Simon Charette
306b687520
Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).
...
This prevent having to pass simple_col through multiple function calls
by defining whether or not references should be resolved with aliases
at the Query level.
2019-11-21 11:56:35 +01:00
Daniel Izquierdo
89abecc75d
Fixed #27272 -- Added an on_delete RESTRICT handler to allow cascading deletions while protecting direct ones.
2019-11-19 10:55:05 +01:00
Daniel Izquierdo
4e1d809aa5
Refs #27272 -- Added Collector.add_dependency().
2019-11-19 10:49:47 +01:00
Caio Ariede
555bebe774
Fixed #30987 -- Added models.PositiveBigIntegerField.
2019-11-19 09:34:11 +01:00
Simon Charette
11e327a3ff
Fixed #30988 -- Deprecated the InvalidQuery exception.
...
It was barely documented without pointers at its defining location and
was abused to prevent misuse of the QuerySet field deferring feature.
2019-11-18 14:06:51 +01:00
Simon Charette
3ca77e2b84
Replaced QueryWrapper single usage with RawSQL.
2019-11-18 10:45:24 +01:00
George Marshall
8be79984dc
Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing list values to tuples.
...
Regression in 8a281aa7fe
.
2019-11-13 08:27:26 +01:00
Hasan Ramezani
153c7956f8
Fixed #24858 -- Added support for get_FOO_display() to ArrayField and RangeFields.
...
_get_FIELD_display() crashed when Field.choices was unhashable.
2019-11-08 10:59:24 +01:00
Hasan Ramezani
dc60597eb6
Refs #30095 -- Added Field._choices_is_value().
...
This allows fields classes to override the validation of choices'
values.
2019-11-05 11:48:44 +01:00
Nick Pope
7286eaf681
Refs #13312 -- Simplified handling of nulls ordering on MySQL.
...
MySQL & MariaDB support the standard IS NULL and IS NOT NULL so
the same workaround used for NULLS FIRST and NULLS LAST that is
used for SQLite < 3.30.0 can be used.
Thanks Simon Charette for the discussion.
2019-11-04 14:47:58 +01:00
Carlton Gibson
2d38eb0ab9
Fixed #30931 -- Restored ability to override Model.get_FIELD_display().
...
Thanks Sergey Fedoseev for the implementation idea.
Regression in a68ea23101
.
2019-11-04 07:55:34 +01:00
Simon Charette
a699595fce
Refs #13312 -- Removed unnecessary IF wrapping in nulls_last handling on MySQL.
...
ISNULL function already returns 0 and 1 on MySQL.
2019-10-31 20:17:04 +01:00
Mariusz Felisiak
a9bd01d363
Refs #30095 -- Simplified Field._check_choices() a bit.
...
Using an internal is_value() hook to check whether Field.choices
is iterable is misleading.
2019-10-31 20:04:47 +01:00
Hasan Ramezani
e3d0b4d550
Fixed #30899 -- Lazily compiled import time regular expressions.
2019-10-29 09:22:26 +01:00
Carlton Gibson
dbcd7b064e
Fixed #30902 -- Added __str__() for model choice enums.
...
Allows expected behavior when cast to str, also matching behaviour of
created instances with those fetched from the DB.
Thanks to Simon Charette, Nick Pope, and Shai Berger for reviews.
2019-10-25 09:19:56 +02:00
Simon Charette
7acef095d7
Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.
...
This required moving the entirety of DELETE SQL generation to the
compiler where it should have been in the first place and implementing
a specialized compiler on MySQL/MariaDB.
The MySQL compiler relies on the "DELETE table FROM table JOIN" syntax
for queries spanning over multiple tables.
2019-10-24 12:24:53 +02:00
Dan Moore
bc94e3c1a2
Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse relationships.
2019-10-23 10:50:31 +02:00
Alex Aktsipetrov
681f7e2b13
Fixed #20577 -- Deferred filtering of prefetched related querysets.
...
Added internal interface to QuerySet that allows to defer next filter
call till .query is accessed. Used it to optimize prefetch_related().
Thanks Simon Charette for the review.
2019-10-21 13:21:54 +02:00
Alex Aktsipetrov
70d8146986
Adjusted QuerySet._filter_or_exclude() call to use negated=False, rather than None.
...
None was a remnant from the times _filter_or_exclude accepted
qtype/mapper as the first arg.
2019-10-21 12:45:17 +02:00
Ahmet Kucuk
09578f6dfb
Fixed #30827 -- Made batch_size arg of QuerySet.bulk_create() respect DatabaseOperations.bulk_batch_size().
...
Thanks Chetan Khanna for tests.
2019-10-21 11:46:44 +02:00
André Ericson
31174031f1
Fixed #30841 -- Deprecated using non-boolean values for isnull lookup.
2019-10-21 08:44:20 +02:00
sage
6f82df69ef
Refs #12990 -- Moved CheckFieldDefaultMixin to the django.db.models.fields.mixins.
2019-10-17 12:30:29 +02:00
Hasan Ramezani
6a75cea76a
Fixed #30854 -- Fixed QuerySet.select_related() with multiple FilteredRelations.
2019-10-11 08:10:48 +02:00
Hasan Ramezani
e1ae2b0050
Refs #30854 -- Moved local_setter() outside the loop in SQLCompiler.get_related_selections().
2019-10-11 08:07:07 +02:00
Simon Charette
8b10357854
Fixed #30860 -- Disabled unneeded NULLS FIRST/LAST workaround on SQLite 3.30+.
2019-10-09 10:47:49 +02:00
Simon Charette
26c66f4519
Fixed #30856 -- Combined fast-delete queries by model during cascade deletion.
...
Reduced the number of queries required when performing cascade deletion
for a model referenced multiple time by another one by performing an
union of reference lookups.
2019-10-09 09:49:53 +02:00
Simon Charette
44522d1036
Made Collector.collect() return immediately for disabled related collection.
2019-10-09 09:49:53 +02:00
Simon Charette
832aa08afe
Used defaultdict in deletion.Collector.
2019-10-09 09:49:27 +02:00
Mariusz Felisiak
02ba48bc23
Removed redundant names in django.db.models.functions.__all__.
2019-10-02 13:07:14 +02:00
Anatol Ulrich
8ed6788aa4
Fixed #30821 -- Added ExtractIsoWeekYear database function and iso_week_day lookup.
2019-10-02 10:41:34 +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
Hasan Ramezani
95a11578ce
Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
...
Regression in 440505cb2c
.
2019-09-27 14:22:31 +02:00
Hasan Ramezani
c7944628a1
Refs #30798 -- Prevented chaining fields from the same related model multiple times in model Meta.ordering.
2019-09-27 13:57:22 +02:00
Mads Jensen
129583a0d3
Removed some outdated backwards compatibility imports and misleading comments.
...
EmptyResultSet moved in 46509cf13d
.
FieldDoesNotExist moved in 8958170755
.
BoundField and pretty_name moved in 8550161e53
.
EMPTY_VALUES moved in 471596fc1a
.
BaseRunserverCommand moved in 5c53e30607
.
2019-09-24 15:18:53 +02:00
Mariusz Felisiak
01104368ff
Refs #29444 -- Removed redundant DatabaseFeatures.can_return_multiple_columns_from_insert.
...
Unnecessary since b31e63879e
.
2019-09-24 10:37:22 +02:00
Johannes Hoppe
b31e63879e
Fixed #29444 -- Allowed returning multiple fields from INSERT statements on Oracle.
2019-09-24 10:22:43 +02:00
Simon Charette
37f8f29377
Fixed #30796 -- Prevented select_related() from mutating a queryset on chaining.
...
Thanks Darren Maki for the report.
2019-09-24 09:17:45 +02:00
Hasan Ramezani
f97bbad908
Fixed #13296 -- Fixed ordering by Options.order_with_respect_to after deleting objects.
...
Thanks Simon Meers for the original patch.
2019-09-23 11:20:37 +02:00
Ian Foote
d9881a025c
Fixed #29915 -- Added support for values with hyphens to pattern lookups for UUIDField on backends without UUID datatype.
...
Support hyphens in iexact, contains, icontains, startswith, istartswith,
endswith and iendswith UUIDField filters on backends without UUID
datatype.
2019-09-23 08:24:08 +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
Mariusz Felisiak
0ddb4ebf7b
Refs #14357 -- Made Meta.ordering not affect GROUP BY queries.
...
Per deprecation timeline.
2019-09-10 12:01:00 +02:00
Simon Charette
34decdebf1
Fixed #30754 -- Prevented inclusion of aliases in partial index conditions.
...
SQLite doesn't repoint table aliases in partial index conditions on table
rename which breaks the documented table alteration procedure.
Thanks Pēteris Caune for the report.
2019-09-10 10:03:16 +02:00
Vojtech Bocek
b1d37fea8f
Fixed #28107 -- Added DatabaseFeatures.allows_group_by_selected_pks_on_model() to allow enabling optimization for unmanaged models.
2019-09-09 14:04:46 +02:00
Johannes Hoppe
7254f1138d
Refs #29444 -- Allowed returning multiple fields from INSERT statements on PostgreSQL.
...
Thanks Florian Apolloner, Tim Graham, Simon Charette, Nick Pope, and
Mariusz Felisiak for reviews.
2019-09-09 10:51:14 +02:00
Nick Pope
b6251956b6
Fixed #30757 -- Added a system check to ensure max_length fits the longest choice.
2019-09-09 10:28:18 +02:00
Shai Berger
72ebe85a26
Fixed #27910 -- Added enumeration helpers for use in Field.choices.
...
These classes can serve as a base class for user enums, supporting
translatable human-readable names, or names automatically inferred
from the enum member name.
Additional properties make it easy to access the list of names, values
and display labels.
Thanks to the following for ideas and reviews:
Carlton Gibson, Fran Hrženjak, Ian Foote, Mariusz Felisiak, Shai Berger.
Co-authored-by: Shai Berger <shai@platonix.com>
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-09-04 14:42:49 +02:00
Simon Charette
13a8884a08
Fixed #30739 -- 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
Simon Charette
600628f8f0
Refs #28442 -- Adjusted related lookups handling of expression rhs.
...
Expressions should never be prepared as other Lookup.get_prep_lookup
implementations hint at by returning early on the presence of the
resolve_expression attribute.
The previous solution was only handling lookups against related fields
pointing at AutoFields and would break for foreign keys to other fields.
It was also causing bidirectional coupling between model fields and
expressions which the method level import of OuterRef was a symptom of.
2019-09-02 10:52:36 +02:00
Mariusz Felisiak
d275fd04f3
Refs #25367 -- Simplified OrderBy and Lookup by using Case() instead of RawSQL() on Oracle.
...
Follow up to efa1908f66
.
2019-08-29 11:56:12 +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
Andrew Brown
691def10a0
Fixed #30727 -- Made Subquery pickle without evaluating their QuerySet.
...
Subquery expression objects, when pickled, were evaluating the QuerySet
objects saved in its _constructor_args attribute.
2019-08-27 13:05:20 +02:00
Mads Jensen
85ac838d9e
Fixed #21039 -- Added AddIndexConcurrently/RemoveIndexConcurrently operations for PostgreSQL.
...
Thanks to Simon Charettes for review.
Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
2019-08-21 13:10:06 +02:00
Nick Pope
21e559495b
Fixed #29979 , Refs #17337 -- Extracted AutoField field logic into a mixin and refactored AutoFields.
...
This reduces duplication by allowing AutoField, BigAutoField and
SmallAutoField to inherit from IntegerField, BigIntegerField and
SmallIntegerField respectively. Doing so also allows for enabling the
max_length warning check and minimum/maximum value validation for auto
fields, as well as providing a mixin that can be used for other possible
future auto field types such as a theoretical UUIDAutoField.
2019-08-20 09:22:25 +02:00
Hasan Ramezani
85458e94e3
Fixed #29260 -- Skipped an UPDATE when adding a model instance with primary key that has a default.
2019-08-19 13:28:35 +02:00
Claude Paroz
d1c2e6dd04
Refs #28428 -- Made FileField.upload_to support pathlib.Path.
2019-08-18 20:34:58 +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
Andrew Brown
8a281aa7fe
Fixed #30687 -- Fixed using of OuterRef() expressions in distance lookups.
2019-08-16 06:50:33 +02:00
zeyneloz
00035672a4
Fixed #30449 -- Fixed RelatedFieldListFilter/RelatedOnlyFieldListFilter to respect model's Meta.ordering.
...
Regression in 6d4e5feb79
.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-08-15 10:29:05 +02:00
Mads Jensen
0b8d911d28
Optimized Field.deconstruct() by using elif.
2019-08-14 10:50:31 +02:00
Simon Charette
efa1908f66
Refs #25367 -- Moved Oracle Exists() handling to contextual methods.
...
Oracle requires the EXISTS expression to be wrapped in a CASE WHEN in
the following cases.
1. When part of a SELECT clause.
2. When part of a ORDER BY clause.
3. When compared against another expression in the WHERE clause.
This commit moves the systematic CASE WHEN wrapping of Exists.as_oracle
to contextual .select_format, Lookup.as_oracle, and OrderBy.as_oracle
methods in order to avoid unnecessary wrapping.
2019-08-13 06:48:14 +02:00
Simon Charette
fff5186d32
Refs #25367 -- Moved select_format hook to BaseExpression.
...
This will expose an intermediary hook for expressions that need special
formatting when used in a SELECT clause.
2019-08-13 06:48:14 +02:00
Simon Charette
088a6fab1c
Refs #24793 -- Removed bogus connection argument from SQLCompiler.compile() calls.
...
The method doesn't expect a connection object to be passed as its second
argument.
2019-08-12 07:47:55 +02:00
Simon Charette
8b3e1b6e9e
Refs #11964 -- Made constraint support check respect required_db_features.
...
This will notably silence the warnings issued when running the test
suite on MySQL.
2019-08-12 06:44:37 +02:00
Diederik van der Boor
25f21bd237
Fixed #28393 -- 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
aaktsipetrov
4edad1ddf6
Fixed #30668 -- Made QuerySet.filter() raise NotSupportedError if any of source expressions is not filterable.
2019-08-02 15:06:00 +02:00
Nick Pope
194d1dfc18
Fixed #30661 -- Added models.SmallAutoField.
2019-08-02 11:39:01 +02:00
Étienne Beaulé
5f24e7158e
Fixed #30665 -- Added support for distinct argument to Avg() and Sum().
2019-07-31 11:22:50 +02:00
Jon Dufresne
4122d9d3f1
Refs #28147 -- Fixed setting of OneToOne and Foreign Key fields to None when using attnames.
...
Regression in 519016e5f2
.
2019-07-27 12:04:56 +02:00
Mariusz Felisiak
806ba19bbf
Added Query.is_sliced property.
...
Previously, we used Query.can_filter() mainly to check if a query is
sliced what was confusing.
2019-07-25 20:45:55 +02:00
Hasan Ramezani
1853383969
Fixed #27995 -- Added error messages on unsupported operations following union(), intersection(), and difference().
2019-07-25 12:39:55 +02:00
Jon Dufresne
5ed20b3aa3
Fixed #30657 -- Allowed customizing Field's descriptors with a descriptor_class attribute.
...
Allows model fields to override the descriptor class used on the model
instance attribute.
2019-07-25 08:15:20 +02:00
Jon Dufresne
93ffa81bc5
Refs #30657 -- Made DeferredAttribute.__init__() to take a field instance instead of a field name.
2019-07-25 07:24:52 +02:00
Jon Dufresne
d89053585e
Improved error message when index in __getitem__() is invalid.
2019-07-23 20:12:08 +02:00
Jon Dufresne
60dc957a82
Removed unnecessary code in Model.__init__().
...
As is_related_object is True, the val variable is unused for the
remainder of the method.
Unnecessary since 53da1e4794
.
2019-07-23 07:45:07 +02:00
Hasan Ramezani
402e6d292f
Fixed #30602 -- Made Extract raise ValueError when using unsupported lookups for DurationField.
2019-07-12 08:08:35 +02:00
Mariusz Felisiak
7a42cfcfdc
Refs #30557 -- Fixed crash of ordering by ptr fields when Meta.ordering contains F() expressions.
...
Thanks Can Sarıgöl for the report.
Follow up to 8c5f9906c5
.
2019-07-11 13:40:36 +02:00
Hasan Ramezani
8c5f9906c5
Fixed #30557 -- Fixed crash of ordering by ptr fields when Meta.ordering contains expressions.
2019-07-11 11:24:59 +02:00
can
52545e788d
Fixed #28289 -- Fixed crash of RawSQL annotations on inherited model fields.
2019-07-11 08:27:15 +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 bc7e288ca9
.
2019-07-10 07:46:08 +02:00
can
febe136d4c
Fixed #30397 -- Added app_label/class interpolation for names of indexes and constraints.
2019-07-08 14:57:56 +02:00
Johannes Hoppe
bc91f27a86
Refs #29444 -- Added support for fetching a returned non-integer insert values on Oracle.
...
This is currently not actively used, since the ORM will ask the
SQL compiler to only return auto fields.
2019-07-08 08:53:08 +02:00
can
53209f7830
Fixed #30613 -- Moved index name validation to system checks.
2019-07-05 09:30:21 +02:00
Jon Dufresne
42b9a23267
Fixed #30400 -- Improved typography of user facing strings.
...
Thanks Claude Paroz for assistance with translations.
2019-06-28 16:46:18 +02:00
can
f03b7bd114
Fixed #28408 -- Added error message when updating with annotated expressions on joined fields.
...
Co-Authored-By: Simon Charette <charette.s@gmail.com>
2019-06-28 07:55:32 +02:00
can
325d5d6445
Fixed #30477 -- Made reverse lookup use Field.get_db_prep_value() from the target field.
2019-06-25 10:20:33 +02:00
Nadège Michel
87b1ad6e73
Fixed #30421 -- Allowed symmetrical intermediate table for self-referential ManyToManyField.
2019-06-21 15:03:17 +02:00
can
2cbd3967e0
Fixed #29834 -- Fixed column mismatch crash with QuerySet.values()/values_list() and order_by() on combined querysets.
2019-06-19 12:11:28 +02:00
Mariusz Felisiak
14d026cccb
Fixed #30572 -- Prevented values()/values_list() on combined queryset from mutating the list of columns in querysets.
2019-06-19 10:44:53 +02:00
CruxBox
34f8eeea4a
Fixed #30548 -- Improved exception when expression contains mixed types.
2019-06-10 19:48:53 +02:00
Étienne Beaulé
4b6dfe1622
Fixed #30542 -- Fixed crash of numerical aggregations with filter.
...
Filters in annotations crashed when used with numerical-type
aggregations (i.e. Avg, StdDev, and Variance). This was caused as the
source expressions no not necessarily have an output_field (such as the
filter field), which lead to an AttributeError: 'WhereNode' object has
no attribute output_field.
Thanks to Chuan-Zheng Lee for the report.
Regression in c690afb873
and two following
commits.
2019-06-05 08:06:26 +02:00
Mariusz Felisiak
f6075fb333
Fixed #26192 -- Fixed crash of ordering by constants on PostgreSQL.
...
Thanks Simon Charette for the review.
2019-05-31 07:38:48 +02:00
葛汉斌
fcbc502af9
Simplified Model.save() a bit.
2019-05-28 15:40:31 +02:00
Mariusz Felisiak
f8b8b00f01
Fixed #30501 -- Preventing QuerySet.reverse() from mutating expressions in QuerySet.order_by and Meta.ordering.
2019-05-23 20:33:37 +02:00
Rob
519016e5f2
Fixed #28147 -- Fixed loss of assigned parent when saving child after parent.
...
Thanks Erwin Junge for the initial patch.
2019-05-21 10:11:22 +02:00
Simon Charette
514104cf23
Refs #29396 , #30494 -- Reduced code duplication in year lookups.
2019-05-21 07:25:09 +02:00
Simon Charette
2b582a7b84
Fixed #29396 -- Added indirect values support to __year lookups.
...
Thanks Windson Yang for the initial patch.
2019-05-21 07:12:33 +02:00
Simon Charette
4d1420947e
Fixed #30494 -- Disabled __year lookup optimization for indirect values.
...
The previous heuristics were naively enabling the BETWEEN optimization on
successful cast of the first rhs SQL params to an integer while it was
not appropriate for a lot of database resolved expressions.
Thanks Alexey Chernov for the report.
2019-05-21 07:11:26 +02:00
ruchit2801
04042b2b44
Fixed #30463 -- Fixed crash of deprecation message when Meta.ordering contains expressions.
...
Regression in 1b1f64ee5a
.
2019-05-18 19:29:00 +02:00
Iain Watts
59ffafa1d2
Fixed #30482 -- Prevented unnecessary evaluation of lookup.queryset in prefetch_related_objects().
2019-05-16 21:39:55 +02:00
Rob
c231a75112
Fixed #30436 -- Added check that on_delete is callable in ForeignKey and OneToOneField.
2019-05-13 07:25:42 +02:00
Amir Hadi
330638b89f
Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows.
...
Co-authored-by: Tim Graham <timograham@gmail.com>
Co-authored-by: Patryk Zawadzki <patrys@room-303.com>
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-05-12 07:05:24 +02:00
Rob
6b736dd074
Fixed #30349 -- Fixed QuerySet.exclude() on FilteredRelation.
...
Using annotated FilteredRelations raised a FieldError when coupled with
exclude(). This is due to not passing filtered relation fields to the
subquery created in split_exclude(). We fixed this issue by passing the
filtered relation data to the newly created subquery.
Secondly, in the case where an INNER JOIN is used in the excluded
subquery, the ORM would trim the filtered relation INNER JOIN in attempt
to simplify the query. This will also remove the ON clause filters
generated by the FilteredRelation. We added logic to not trim the INNER
JOIN if it is from FilteredRelation.
2019-05-07 14:47:50 +02:00
Tobias Kunze
a44a21a22f
Fixed #26678 -- Doc'd that RelatedManager.add()/remove()/set() accepts the field the relation points to.
2019-05-07 08:55:45 +02:00
Stephen Brown
86a3ad351e
Fixed #30339 -- Made Model.delete(keep_parents=True) preserves nested parent reverse relationships.
...
Thanks Simon Charette for the review.
2019-05-06 13:04:31 +02:00
can
567b9928a3
Fixed #29692 -- Fixed removing ordering parts for multiline RawSQL expressions.
2019-05-03 07:37:37 +02:00
Mykola Kokalko
ef082ebb84
Fixed #29529 -- Allowed models.fields.FilePathField to accept a callable path.
2019-05-02 11:11:56 +02:00
zeyneloz
6485a5f450
Fixed #30409 -- Allowed using foreign key's attnames in unique/index_together and Index's fields.
2019-05-01 11:51:27 +02:00
can
719b746620
Fixed #30412 -- Fixed crash when adding check constraints with OR'ed condition on Oracle and SQLite.
2019-04-30 12:32:27 +02:00
Jon Dufresne
dbe436a9a9
Simplified Field.contribute_to_class().
2019-04-29 07:54:32 +02:00
can
c00b4dbda2
Fixed #29810 -- Fixed crash of select_related() on FilteredRelation with empty result.
2019-04-23 13:48:33 +02:00
Scott Fitsimones
a14c0fda15
Fixed #30328 -- Fixed crash of IntegerField.validators when limit_value in a custom validator is callable.
2019-04-19 07:58:27 +02:00
Ramiro Morales
aed89adad5
Fixed #30367 -- Changed "pip install" to "python -m pip install" in docs, comments and hints.
2019-04-18 14:41:15 +02:00
Ville Skyttä
03db5fddfd
Fixed typos in docs, comments, and exception messages.
2019-04-18 09:33:53 +02:00
can
d87bd29c4f
Fixed #30335 , #29139 -- Fixed crash when ordering or aggregating over a nested JSONField key transform.
2019-04-18 07:16:50 +02:00
Simon Charette
f110de5c04
Fixed #30191 -- Selected only referenced fields during cascade deletion.
...
The non-referenced fields can only be deferred if no deletion signals
receivers are connected for their respective model as connected as these
receivers might expect all fields of the deleted model to be present.
Thanks Ed Morley for the report.
2019-04-17 13:41:23 +02:00
Simon Charette
26c4be2ebe
Refs #18676 -- Enabled fast-delete for m2m_changed senders.
...
There's no reason to disable fast-delete when an intermediary
many-to-many model has connected m2m_changed receivers because the
signal is only sent when related manager's clear() and remove() methods
are directly called.
This must have been overlooked in 1cd6e04cd4
given no regression tests fail when m2m_changed is not taken into
consideration to determine if fast-delete can be enabled.
2019-04-17 13:24:31 +02:00
Vinny Do
a4055adf70
Fixed #30368 -- Fixed prefetch_related() for GenericForeignKey when PK is also a FK.
2019-04-16 09:49:16 +02:00
Simon Charette
0cb4062482
Refs #23758 -- 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 #27149 -- 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
Mariusz Felisiak
5f7991c42c
Fixed #30325 -- Reverted "Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on a many-to-many relation."
...
This reverts commit 1299421cad
due to
a regression with custom managers.
2019-04-15 12:02:26 +02:00
Mariusz Felisiak
1afbc96a75
Fixed #30343 -- Fixed prefetch_related() for GenericForeignKey when PK of related field is UUIDField.
2019-04-14 10:02:59 +02:00
Florian Apolloner
afc708cf6d
Fixed #30330 -- Fixed setting of primary key to None during fast-delete.
...
Regression in bc7dd8490b
.
2019-04-08 21:14:00 +02:00
David Beitey
8bdb12c1d3
Fixed typo in django/db/models/query_utils.py comment.
2019-04-03 08:18:54 +02:00
Mariusz Felisiak
2a431db0f5
Fixed #28621 -- Fixed crash of annotations with OuterRef.
2019-03-27 08:24:05 +01:00
Hasan Ramezani
981dd6dd71
Fixed #28431 -- Added a system check for BinaryField to prevent strings defaults.
...
Thanks Claude Paroz for the initial patch.
2019-03-25 20:04:35 +01:00
Simon Charette
1ca825e4dc
Fixed #30246 -- Reused annotation aliases references in aggregation filters.
...
Thanks Jan Baryła for the detailed report and the reduced test case.
2019-03-23 10:11:45 -04: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
f19a4945e1
Fixed #21703 -- Fixed a crash when excluding a related field with a F().
2019-03-23 09:48:28 -04:00
Matthias Kestenholz
ea071870f9
Fixed #30280 -- Restored Model.get_FIELD_display()'s coercion of lazy strings.
...
Reverted cc79c7ee63
.
2019-03-22 12:30:10 -04:00
Nick Pope
d26b242443
Fixed #30271 -- Added the Sign database function.
2019-03-22 12:52:39 +01:00
Simon Charette
5935a9aead
Removed obsolete Lookup hook to prepare rhs expressions.
...
After 3a505c70e7
, all _prepare() methods
return self.
2019-03-21 20:54:21 -04:00
Simon Charette
3a505c70e7
Refs #27149 , #29542 -- Simplified subquery parentheses wrapping logic.
2019-03-21 20:42:26 -04:00
Simon Charette
3543129822
Refs #27149 -- 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 #30188 .
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 #21703 .
2019-03-21 20:36:31 -04:00
Simon Charette
96b6ad94d9
Refs #27149 -- Made Subquery store Query instead of Queryset.
...
Subquery only uses Query.
2019-03-21 20:02:51 -04:00
Simon Charette
fb3f034f1c
Fixed #30158 -- Avoided unnecessary subquery group by on aggregation.
...
Subquery annotations can be omitted from the GROUP BY clause on aggregation
as long as they are not explicitly grouped against.
Thanks Jonny Fuller for the report.
2019-03-21 18:48:41 -04:00
Simon Charette
9dc367dc10
Refs #30158 -- Added alias argument to Expression.get_group_by_cols().
2019-03-21 18:47:46 -04:00
Nick Pope
0b70985f42
Fixed #30240 -- Added SHA1, SHA224, SHA256, SHA384, and SHA512 database functions.
...
Thanks Mariusz Felisiak and Tim Graham for reviews.
2019-03-20 19:30:43 +01:00
Matt Westcott
58ad030d05
Fixed #30254 -- Allowed model metaclasses to access the attribute dict in __init__().
...
Regression in a68ea23101
.
2019-03-14 21:05:23 -04:00
ahbk
d527639804
Fixed #29754 -- Added is_dst parameter to Trunc database functions.
2019-03-07 10:02:18 -05:00
avas9366
9681e968eb
Fixed #30232 -- Corrected expected format in invalid DurationField error message.
2019-03-04 19:25:27 -05:00