summaryrefslogtreecommitdiff
path: root/django/db/models/query.py
AgeCommit message (Collapse)Author
2021-02-11[3.2.x] Fixed #32433 -- Added error message on QuerySet.delete() following ↵Egidijus Macijauskas
distinct(). Backport of 6307c3f1a123f5975c73b231e8ac4f115fd72c0d from master
2021-01-05Fixed #32231 -- Allowed passing None params to QuerySet.raw().Alexander Lyabah
2020-12-16Fixed #32089 -- Fixed prefetch_related_objects() when some objects are ↵Alexey Nigin
already fetched. Thanks Dennis Kliban for the report and Adam Johnson for the initial patch. Co-authored-by: Adam Johnson <me@adamj.eu>
2020-10-28Made small readability improvements.Martin Thoma
2020-10-26Fixed #29497 -- Fixed loss of assigned parent when saving child with ↵Hannes Ljungberg
bulk_create() after parent.
2020-10-19Fixed #32116 -- Fixed QuerySet.order_by() crash on EmptyQuerySet with ↵Hannes Ljungberg
union() on a single non-empty ordered queryset.
2020-10-05Fixed #32068 -- Added error messages on get() with filters following ↵Hasan Ramezani
union(), intersection(), and difference().
2020-09-29Fixed #31880 -- Made QuerySet.aggregate() raise FieldError when aggregating ↵David Wobrock
over aggregation aliases.
2020-09-16Fixed #31843 -- Fixed pickling named values from QuerySet.values_list().Kwist
2020-09-14Fixed #31990 -- Fixed QuerySet.ordered for GROUP BY queries on models with ↵Mariusz Felisiak
Meta.ordering. Regression in 0ddb4ebf7bfcc4730c80a772dd146a49ef6895f6. Thanks Julien Dutriaux for the report.
2020-09-11Fixed #31943 -- Fixed recreating QuerySet.values()/values_list() when using ↵Hasan Ramezani
a pickled Query.
2020-08-27Fixed #31947 -- Made QuerySet.update_or_create() reuse get_or_create().Alexander
2020-08-26Fixed #31918 -- Allowed QuerySet.in_bulk() to fetch on a single distinct field.Kaustubh
2020-07-31Fixed #27719 -- Added QuerySet.alias() to allow creating reusable aliases.Alexandr Tatarinov
QuerySet.alias() allows creating reusable aliases for expressions that don't need to be selected but are used for filtering, ordering, or as a part of complex expressions. Thanks Simon Charette for reviews.
2020-07-29Fixed #31783 -- Fixed crash when filtering againts "negate" field.Hasan Ramezani
Thanks Simon Charette for the initial patch.
2020-05-21Fixed #30375 -- Added FOR NO KEY UPDATE support to ↵Manuel Weitzman
QuerySet.select_for_update() on PostgreSQL.
2020-05-13Fixed #31580 -- Added error messages on distinct() following union(), ↵Hasan Ramezani
intersection(), and difference().
2020-05-11Optimized Model and QuerySet pickling version comparison.Adam Johnson
2020-04-23Fixed #31500 -- Fixed detecting of unique fields in QuerySet.in_bulk() when ↵Hannes Ljungberg
using Meta.constraints. Detection of unique fields now takes into account non-partial unique constraints.
2020-04-15Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet.sobolevn
2020-03-31Refs #31403 -- Made SQLInsertCompiler.execute_sql() always return an ↵Adam Johnson
iterable of rows. List of tuples.
2020-03-20Refs #29724 -- Added is_dst parameter to QuerySet.datetimes().Hasan Ramezani
Thanks Simon Charette for the review and Mariusz Felisiak for tests.
2020-02-06Fixed #31233 -- Closed database connections and cursors after use.Jon Dufresne
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-01-20Changed re-raising an exception to use bare raise syntax where appropriate.Jon Dufresne
2020-01-09Fixed #31148 -- Added error messages on update()/delete() operations ↵Hasan Ramezani
following union(), intersection(), and difference().
2019-12-09Refs #31044 -- Fixed error message when using Prefetch with a values_list() ↵Mariusz Felisiak
queryset.
2019-12-09Fixed #31044 -- Errored nicely when using Prefetch with a raw() queryset.Hasan Ramezani
2019-12-03Refs #31046 -- Added django.db.models.utils.resolve_callables().Baptiste Mispelon
2019-11-18Fixed #30988 -- Deprecated the InvalidQuery exception.Simon Charette
It was barely documented without pointers at its defining location and was abused to prevent misuse of the QuerySet field deferring feature.
2019-10-24Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.Simon Charette
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-21Fixed #20577 -- Deferred filtering of prefetched related querysets.Alex Aktsipetrov
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-21Adjusted QuerySet._filter_or_exclude() call to use negated=False, rather ↵Alex Aktsipetrov
than None. None was a remnant from the times _filter_or_exclude accepted qtype/mapper as the first arg.
2019-10-21Fixed #30827 -- Made batch_size arg of QuerySet.bulk_create() respect ↵Ahmet Kucuk
DatabaseOperations.bulk_batch_size(). Thanks Chetan Khanna for tests.
2019-10-01Fixed #30651 -- Made __eq__() methods return NotImplemented for not ↵ElizabethU
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-09-24Removed some outdated backwards compatibility imports and misleading comments.Mads Jensen
EmptyResultSet moved in 46509cf13dbf049f75077981c29ef2c60b5a96ab. FieldDoesNotExist moved in 8958170755b37ce346ae5257c1000bd936faa3b0. BoundField and pretty_name moved in 8550161e531a603d57723850fb09c4c9b7ca60b9. EMPTY_VALUES moved in 471596fc1afcb9c6258d317c619eaf5fd394e797. BaseRunserverCommand moved in 5c53e30607014163872e89c221b206992a9acfef.
2019-09-09Refs #29444 -- Allowed returning multiple fields from INSERT statements on ↵Johannes Hoppe
PostgreSQL. Thanks Florian Apolloner, Tim Graham, Simon Charette, Nick Pope, and Mariusz Felisiak for reviews.
2019-07-25Added Query.is_sliced property.Mariusz Felisiak
Previously, we used Query.can_filter() mainly to check if a query is sliced what was confusing.
2019-07-25Fixed #27995 -- Added error messages on unsupported operations following ↵Hasan Ramezani
union(), intersection(), and difference().
2019-07-23Improved error message when index in __getitem__() is invalid.Jon Dufresne
2019-05-16Fixed #30482 -- Prevented unnecessary evaluation of lookup.queryset in ↵Iain Watts
prefetch_related_objects().
2019-05-12Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows.Amir Hadi
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-02-13Fixed #30184 -- Removed ellipsis characters from shell output strings.Dan Davis
Partially reverted 50b8493581fea3d7137dd8db33bac7008868d23a (refs #29654) to avoid a crash when the user shell doesn't support non-ASCII characters.
2019-02-06Fixed #30159 -- Removed unneeded use of OrderedDict.Nick Pope
Dicts preserve order since Python 3.6.
2019-01-30Refs #29444 -- Renamed DatabaseFeatures.can_return_id* to be generic for ↵Johannes Hoppe
other columns.
2019-01-17Refs #11557 -- Removed the field_name keyword argument to ↵Tim Graham
QuerySet.earliest() and latest(). Per deprecation timeline.
2018-12-30Renamed QuerySet.earliest()/latest() helper method.Tim Graham
2018-11-21Fixed #29974 -- Fixed non-truthy primary key values for QuerySet.bulk_update().Tom Forbes
2018-11-21Fixed #29949 -- Refactored db introspection identifier converters.Mariusz Felisiak
Removed DatabaseIntrospection.table_name_converter()/column_name_converter() and use instead DatabaseIntrospection.identifier_converter(). Removed DatabaseFeatures.uppercases_column_names. Thanks Tim Graham for the initial patch and review and Simon Charette for the review.
2018-11-17Refs #29908 -- Optimized known related objects assignment.Simon Charette
Since CPython implements a C level attrgetter(*attrs) it even outperforms the most common case of a single known related object since the resulting attribute values tuple is built in C.