summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2023-03-28[4.2.x] Fixed #34443 -- Fixed filtering by transforms on reverse relations.Mariusz Felisiak
Regression in ce6230aa976e8d963226a3956b45a8919215dbd8. Backport of 996c802229b93fe83c39842e56c6b8668464deaf from main
2023-02-01[4.2.x] Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0 Backport of 097e3a70c1481ee7b042b2edd91b2be86fb7b5b6 from main
2023-01-23[4.2.x] Fixed #34192 -- Preserved callable storage when it returns ↵Matt Westcott
default_storage. Backport of ef85b6bf0bc5a8b194f0724cf5bbedbcee402b96 from main
2022-12-28Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.Adrian Torres
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-28Fixed #18468 -- Added support for comments on columns and tables.kimsoungryoul
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz Felisiak for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-12-24Used allow_migrate_model() shortcut in Field._check_backend_specific_checks().Mariusz Felisiak
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-01Refs #33308 -- Deprecated support for passing encoded JSON string literals ↵Simon Charette
to JSONField & co. JSON should be provided as literal Python objects an not in their encoded string literal forms.
2022-11-18Removed unnecessary ForeignKey.get_reverse_path_info().Mariusz Felisiak
get_reverse_path_info() is already inherited from ForeignObject.
2022-11-15Refs #33308 -- Used get_db_prep_value() to adapt JSONFields.Simon Charette
2022-11-09Fixed #34135 -- Added async-compatible interface to related managers.Jon Janzen
2022-11-08Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() ↵Jon Janzen
methods for related managers. Bug in 58b27e0dbb3d31ca1438790870b2b51ecdb10500.
2022-11-07Refs #33374 -- Adjusted full match condition handling.Simon Charette
Adjusting WhereNode.as_sql() to raise an exception when encoutering a full match just like with empty matches ensures that all case are explicitly handled.
2022-11-07Refs #33308 -- Improved adapting DecimalField values to decimal.Florian Apolloner
2022-11-04Fixed #27654 -- Propagated alters_data attribute to callables overridden in ↵LightDiscord
subclasses. Thanks Shai Berger and Adam Johnson for reviews and the implementation idea.
2022-10-31Used more augmented assignment statements.Nick Pope
Identified using the following command: $ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
2022-09-30Fixed #33984 -- Reverted "Fixed #32980 -- Made models cache related managers."Mariusz Felisiak
This reverts 4f8c7fd9d91b35e2c2922de4bb50c8c8066cbbc6 and adds two regression tests: - test_related_manager_refresh(), and - test_create_copy_with_m2m(). Thanks joeli for the report.
2022-09-16Fixed #33966 -- Added support for using KeyTextTransform from lookup.Allen Jonathan David
2022-09-09Fixed #33975 -- Fixed __in lookup when rhs is a queryset with annotate() and ↵DevilsAutumn
alias(). This fixes clearing selected fields.
2022-09-06Refs #26780 -- Made prefetch_related() don't use window expressions fo ↵Mariusz Felisiak
sliced queries if not supported.
2022-09-02Fixed #29799 -- Allowed registering lookups per field instances.Allen Jonathan David
Thanks Simon Charette and Mariusz Felisiak for reviews and mentoring this Google Summer of Code 2022 project.
2022-08-27Fixed #33954 -- Prevented models.DecimalField from accepting NaN, Inf, and ↵Mohamed Karam
-Inf values.
2022-08-27Fixed #33952 -- Reallowed creating reverse foreign key managers on unsaved ↵David Wobrock
instances. Thanks Claude Paroz for the report. Regression in 7ba6ebe9149ae38257d70100e8bfbfd0da189862.
2022-08-25Fixed typo in django/db/models/fields/files.py comment.Jan Pieter Waagmeester
2022-08-18Refs #26511 -- Fixed json.KeyTextTransform() on MySQL/MariaDB.Mariusz Felisiak
2022-08-15Fixed #26780 -- Added prefetch_related() support for sliced queries.Simon Charette
This was made possible by window function filtering support added in f387d024fc75569d2a4a338bfda76cc2f328f627.
2022-08-15Refs #28333 -- Added partial support for filtering against window functions.Simon Charette
Adds support for joint predicates against window annotations through subquery wrapping while maintaining errors for disjointed filter attempts. The "qualify" wording was used to refer to predicates against window annotations as it's the name of a specialized Snowflake extension to SQL that is to window functions what HAVING is to aggregates. While not complete the implementation should cover most of the common use cases for filtering against window functions without requiring the complex subquery pushdown and predicate re-aliasing machinery to deal with disjointed predicates against columns, aggregates, and window functions. A complete disjointed filtering implementation should likely be deferred until proper QUALIFY support lands or the ORM gains a proper subquery pushdown interface.
2022-07-27Refs #32948, Refs #32946 -- Used Q.create() internally for dynamic Q() objects.Nick Pope
Node.create() which has a compatible signature with Node.__init__() takes in a single `children` argument rather than relying in unpacking *args in Q.__init__() which calls Node.__init__(). In addition, we were often needing to unpack iterables into *args and can instead pass a list direct to Node.create().
2022-07-26Refs #27236 -- Reverted "Refs #27236 -- Refactored out ↵Mariusz Felisiak
DeprecationForHistoricalMigrationMixin." This reverts commit 57793b47657ace966ce8ce96d801ac0d85e5efc6.
2022-07-07Refs #27236 -- Refactored out DeprecationForHistoricalMigrationMixin.David Wobrock
2022-05-17Updated source translation catalogs.Mariusz Felisiak
Forward port of d1f1a0168ab8a2556980ec1410512b5f02502da4 from stable/4.1.x.
2022-05-02Fixed #33413 -- Made migrations propage collations to related fields.David Wobrock
2022-04-29Refs #33413 -- Added collation to CharField/TextField's db_parameters.David Wobrock
2022-04-22Refs #31223 -- Added __class_getitem__() to ForeignKey.Collin Anderson
2022-04-06Fixed #33471 -- Made AlterField operation a noop when changing "choices".sarahboyce
This also allows customizing attributes of fields that don't affect a column definition.
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-03-15Fixed #33552 -- Fixed JSONField has key lookups with numeric keys on ↵Sage Abdullah
MariaDB, MySQL, Oracle, and SQLite.
2022-02-25Fixed #31486 -- Deprecated passing unsaved objects to related filters.Albert Defler
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2022-02-22Fixed #19580 -- Unified behavior of reverse foreign key and many-to-many ↵Albert Defler
relations for unsaved instances.
2022-02-16Fixed #33515 -- Prevented recreation of migration for ManyToManyField to ↵Mariusz Felisiak
lowercased swappable setting. Thanks Chris Lee for the report. Regression in 43289707809c814a70f0db38ca4f82f35f43dbfd. Refs #23916.
2022-02-16Made Field.error_messages a cached property.Collin Anderson
This speeds up field creation and reduces memory usage.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
2022-01-14Fixed #33441 -- Restored immutability of models.Field.__hash__().Adam Johnson
Regression in 502e75f9ed5476ffe8229109acf0c23999d4b533.
2022-01-05Fixed #32511 -- Corrected handling prefetched nested reverse relationships.Jamie Matthews
When prefetching a set of child objects related to a set of parent objects, we usually want to populate the relationship back from the child to the parent to avoid a query when accessing that relationship attribute. However, there's an edge case where the child queryset itself specifies a prefetch back to the parent. In that case, we want to use the prefetched relationship rather than populating the reverse relationship from the parent.
2022-01-04Fixed #33406 -- Avoided creation of MaxLengthValidator(None) when resolving ↵Keryn Knight
Value.output_field for strings. This brings the behaviour in line with Field subclasses which append to the validators within __init__(), like BinaryField, and prevents the creation of a validator which incorrectly throws a TypeError, if it were used.
2021-12-21Fixed #33374 -- Fixed ExpressionWrapper annotations with full queryset.David Wobrock
2021-12-10Corrected return value of ForeignKey.db_check().Adam Johnson
Field.db_check() should return None or a SQL string. Returning [] happened to work because it’s falsey.
2021-12-02Refs #32690 -- Altered lookups Query rhs alterations during initialization.Simon Charette
Having it happen at the lookup creation time ensures entry points called before the compilation phase (e.g. get_group_by_cols) don't have to duplicate the logic in charge of altering Query instances used as rhs. It also has the nice effect of reducing the amount of time the alteration logic to once as opposed to multiple times if the queryset is compiled more than once.