summaryrefslogtreecommitdiff
path: root/django/db/models/query.py
AgeCommit message (Collapse)Author
2019-02-13[2.2.x] Fixed #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. Backport of 2bd8df243ac6fc35e58c9fe90b20c9e42519a5ac from master.
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.
2018-11-15Fixed #17930 -- Allowed ORing (|) with sliced QuerySets.Ian Foote
2018-11-08Fixed #29908 -- Fixed setting of foreign key after related set access if ↵Simon Charette
ForeignKey uses to_field. Adjusted known related objects handling of target fields which relies on from and to_fields and has the side effect of fixing a bug bug causing N+1 queries when using reverse foreign objects. Thanks Carsten Fuchs for the report.
2018-10-17Fixed #21171 -- Avoided starting a transaction when a single (or atomic ↵Florian Apolloner
queries) are executed. Checked the following locations: * Model.save(): If there are parents involved, take the safe way and use transactions since this should be an all or nothing operation. If the model has no parents: * Signals are executed before and after the previous existing transaction -- they were never been part of the transaction. * if `force_insert` is set then only one query is executed -> atomic by definition and no transaction needed. * same applies to `force_update`. * If a primary key is set and no `force_*` is set Django will try an UPDATE and if that returns zero rows it tries an INSERT. The first case is completly save (single query). In the second case a transaction should not produce different results since the update query is basically a no-op then (might miss something though). * QuerySet.update(): no signals issued, single query -> no transaction needed. * Model/Collector.delete(): This one is fun due to the fact that is does many things at once. Most importantly though: It does send signals as part of the transaction, so for maximum backwards compatibility we need to be conservative. To ensure maximum compatibility the transaction here is removed only if the following holds true: * A single instance is being deleted. * There are no signal handlers attached to that instance. * There are no deletions/updates to cascade. * There are no parents which also need deletion.
2018-09-28Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev
2018-09-18Fixed #23646 -- Added QuerySet.bulk_update() to efficiently update many models.Tom Forbes
2018-08-22Refs #29654 -- Replaced three dots with ellipsis character in output strings.Claude Paroz
2018-08-03Fixed #28668 -- Allowed QuerySet.bulk_create() to ignore insert conflicts.Tom
2018-08-02Fixed #29499 -- Fixed race condition in QuerySet.update_or_create().Michael Sanders
A race condition happened when the object didn't already exist and another process/thread created the object before update_or_create() did and then attempted to update the object, also before update_or_create() saved the object. The update by the other process/thread could be lost.
2018-07-16Fixed #29413 -- Prevented evaluation of ↵Viktor Danyliuk
QuerySet.get_or_create()/update_or_create() defaults unless needed. Removed the logic added in 81e05a418dc6f347d9627373288e773c477a9fe0 which was obsolete since dbffffa7dc95fc62cbecfd00284bde62ee796f48.
2018-07-16Fixed #28917 -- Prevented Paginator's unordered warning on EmptyQuerySet.Josh Schneier
Thanks carltongibson for the idea and weijunji for the initial patch.
2018-05-27Fixed #29230 -- Fixed nested prefetches that clash with descriptors.Paulo
2018-04-27Fixed #29367 -- Fixed model state on objects with a primary key created with ↵Oscar Esgalha
QuerySet.bulk_create().
2018-04-19Fixed #28600 -- Added prefetch_related() support to RawQuerySet.Adnan Umer
2018-04-19Fixed #29337 -- Added __len__() & __bool__() to RawQuerySet.Adnan Umer
2018-04-19Fixed #29339 -- Added result caching to RawQuerySet.Adnan Umer
2018-04-19Fixed #28574 -- Added QuerySet.explain().Tom
2018-04-12Fixed #29320 -- Added an exception when an annotation alias matches a ↵Flávio Juvenal
ForeignKey attname.
2018-02-26Refs #28909 -- Simplifed code using unpacking generalizations.Mariusz Felisiak
2018-02-02Fixed imports per isort 4.3.1.Tim Graham
Partially reverted 9bcf73d788866bc93f8248cb2e9d601ecbc4b50c.
2018-02-01Fixed imports per isort 4.3.0.Mariusz Felisiak
2018-01-27Fixed #28650 -- Added TruncWeek database function.Sigurd Ljødal
2018-01-26Fixed #29067 -- Fixed regression in QuerySet.values_list(..., flat=True) ↵Jon Dufresne
followed by annotate().
2018-01-25Fixed #28838 -- Fixed Model.save() crash if the base manager annotates with ↵shanghui
a related field.
2017-12-27Removed unused variable in QuerySet._earliest_or_latest().Mads Jensen
2017-12-11Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking.Nick Pope
2017-12-07Fixed #28907 -- Removed unnecessary if statements.Tim Graham
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-11-28Fixed #28837 -- Fixed test client crash if an exception with more than one ↵Nicolas Delaby
arg is raised. Also removed usage of the problematic pattern elsewhere. Regression in 6e55e1d88a5c4453e25f0caf7ffb68973de5c0ba.
2017-11-21Fixed #28817 -- Made QuerySet.iterator() use server-side cursors after ↵Dražen Odobašić
values() and values_list().
2017-10-03Fixed #28674 -- Removed unused check in QuerySet._batched_insert().Tim Graham
2017-10-02Fixed #28652 -- Fixed a few comments in django/db/models/*.Дилян Палаузов
2017-09-28Merged hash() calls.Mariusz Felisiak
Thanks Simon Charette for the review.
2017-09-28Simplified various __eq__() methods.Mads Jensen
2017-09-22Fixed #27332 -- Added FilteredRelation API for conditional join (ON clause) ↵Nicolas Delaby
support. Thanks Anssi Kääriäinen for contributing to the patch.
2017-09-07Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."Tim Graham
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
2017-09-06Fixed #15648 -- Allowed QuerySet.values_list() to return a namedtuple.Sergey Fedoseev
2017-09-06Replaced deque() with list() in prefetch_related_objects(). Sergey Fedoseev
deque() isn't needed since algorithm doesn't require FIFO.
2017-09-05Fixed #11557 -- Added support for a list of fields in Meta.get_latest_by and ↵François Freitag
QuerySet.earliest()/latest().
2017-09-05Fixed typo in django/db/models/query.py docstring.Boris Burkov
2017-08-23Refs #28459 -- Improved performance of SQLCompiler.apply_converters().Sergey Fedoseev
2017-08-22Refs #28459 -- Improved performance of FlatValuesListIterable.Sergey Fedoseev
2017-08-15Simplified RelatedPopulator.populate().Sergey Fedoseev
2017-08-15Removed redundant condition in QuerySet.resolve_expression().Sergey Fedoseev
2017-08-10Refs #16043 -- Refactored internal fields value cache.Paulo
* Removed all hardcoded logic for _{fieldname}_cache. * Added an internal API for interacting with the field values cache. Thanks carljm and MarkusH for support.
2017-08-08Refs #28459 -- Improved performance of ValuesIterable.Sergey Fedoseev