summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2019-01-14Refs #28643 -- Moved db function mixins to a separate module.Nick Pope
2019-01-14Avoided calling as_oracle() for SQLite in Left database function.Nick Pope
2019-01-14Corrected comment in TruncTime database function.Nick Pope
2019-01-14Simplified overriding source expressions in some database functions.Nick Pope
2019-01-14Fixed #30093 -- Fixed ordering of combined queryset ordered by F expressions.Sergey Fedoseev
2019-01-12Refs #28643 -- Added Reverse database function.Nick Pope
Thanks Mariusz Felisiak for Oracle advice and review.
2019-01-12Fixed #30062 -- Added support for unique conditional constraints.Paveł Tyślacki
2019-01-12Used None as the empty value for condition in Index's SQL construction.Paveł Tyślacki
2019-01-11Moved django.db.migrations.writer.SettingsReference to django.conf.Tim Graham
Reduces the possibility of circular imports.
2019-01-10Refs #28643 -- Added NullIf database function.Mads Jensen
Thanks Nick Pope, Mariusz Felisiak, and Tim Graham for reviews.
2019-01-09Fixed #28658 -- Added DISTINCT handling to the Aggregate class.Simon Charette
2019-01-08Simplified some imports for database functions.Nick Pope
Used more specific modules to reduce the risk of circular imports.
2019-01-02Used 4 space hanging indent for dictionaries.Tim Graham
Thanks Mariusz Felisiak for auditing.
2019-01-01Fixed #30060 -- Moved SQL generation for indexes and constraints to ↵Paveł Tyślacki
SchemaEditor.
2018-12-30Renamed QuerySet.earliest()/latest() helper method.Tim Graham
2018-12-27Fixed #29851 -- Fixed crash of annotations with window expressions in Subquery.Mariusz Felisiak
2018-12-22Fixed #29970, #30041 -- Made ModelBase.__new__() pass attrs without ↵Sergey Fedoseev
contribute_to_class() to type.__new__().
2018-12-06Fixed #29932 -- Fixed combining compound queries with sub-compound queries ↵Mariusz Felisiak
on SQLite and Oracle.
2018-12-06Fixed #30011 -- Fixed queries that reuse filtered aggregates.Simon Charette
Thanks Taqi Abbas and Raphael Kimmig for the report.
2018-11-30Refs #28643 -- Skipped ATan2() workaround on SpatiaLite 5+.Nick Pope
2018-11-30Fixed #30001 -- Marked UUIDField.description for translation.Prabakaran Kumaresshan
2018-11-23Refs #23801 -- Made integer field max_length warning show correct field type.Nick Pope
2018-11-23Removed redundant BigIntegerField.empty_strings_allowed (already inherited).Nick Pope
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-14Fixed #29835 -- Made RelatedFieldListFilter respect ModelAdmin.ordering.Hasan Ramezani
2018-11-13Fixed #29641 -- Added support for unique constraints in Meta.constraints.Simon Charette
This constraint is similar to Meta.unique_together but also allows specifying a name. Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13Refs #29641 -- Refactored database schema constraint creation.Simon Charette
Added a test for constraint names in the database. Updated SQLite introspection to use sqlparse to allow reading the constraint name for table check and unique constraints. Co-authored-by: Ian Foote <python@ian.feete.org>
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-29Fixed #29547 -- Added support for partial indexes.Mads Jensen
Thanks to Ian Foote, Mariusz Felisiak, Simon Charettes, and Markus Holtermann for comments and feedback.
2018-10-28Fixed #29896 -- Fixed incorrect Model.save() cache relation clearing for ↵Tim Graham
foreign keys that use to_field. Regression in ee49306176a2d2f1751cb890bd607d42c7c09196.
2018-10-24Fixed #29869 -- Made UUIDField.to_python() convert integers.Sanyam Khurana
2018-10-22Fixed #27595 -- Made ForeignKey.get_col() follow target chains.Simon Charette
Previously, foreign relationships were followed only one level deep which prevents foreign keys to foreign keys from being resolved appropriately. This was causing issues such as improper database value conversion for UUIDField on SQLite because the resolved expression's output field's internal type wasn't correct. Added tests to make sure unlikely foreign reference cycles don't cause recursion errors. Refs #24343. Thanks oyooyo for the report and Wayne Merry for the investigation.
2018-10-17Moved make_hashable() to django.utils and added tests.aspalding
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-10-15Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on ↵oliver
a many-to-many relation.
2018-10-08Replaced kwargs.pop() with keyword-only arguments.Jon Dufresne
2018-10-08Refs #27795 -- Removed force_text() usage in db/models/sql/query.py.Jon Dufresne
2018-10-02Fixed #29745 -- Based Expression equality on detailed initialization signature.Simon Charette
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-02Refs #29641 -- Extracted reusable CheckConstraint logic into a base class.Simon Charette
2018-10-02Refs #11964 -- Changed CheckConstraint() signature to use keyword-only ↵Simon Charette
arguments. Also renamed the `constraint` argument to `check` to better represent which part of the constraint the provided `Q` object represents.
2018-10-02Added django.db.backends.utils.names_digest() to remove redundant code.Jon Dufresne
2018-10-01Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup error.Abhinav Patil
2018-10-01Fixed #29767 -- Made date-related casts work on SQLiteClaude Paroz
Thanks Rémy Hubscher for the report and Tim Graham and Simon Charette for the reviews.
2018-09-28Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev
2018-09-25Normalized spelling of "lowercase" and "lowercased".Jon Dufresne
2018-09-18Fixed #23646 -- Added QuerySet.bulk_update() to efficiently update many models.Tom Forbes
2018-09-13Refs #14357 -- Deprecated Meta.ordering affecting GROUP BY queries.Ramiro Morales
Thanks Ramiro Morales for contributing to the patch.