summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2022-05-17[4.1.x] Updated source translation catalogs.Mariusz Felisiak
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.
2021-11-08Fixed #32980 -- Made models cache related managers.Keryn Knight
2021-11-03Fixed #32996 -- Cached PathInfos on relations.Keryn Knight
PathInfo values are ostensibly static over the lifetime of the object for which they're requested, so the data can be memoized, quickly amortising the cost over the process' duration.
2021-10-06Fixed #33131 -- Improved error messages for clashing reverse accessor names.Bernd Wechner
2021-09-28Fixed #33033 -- Prevented models.DecimalField from accepting NaN values.Chinmoy Chakraborty
2021-09-24Fixed #33124 -- Avoided accessing the database connections when not necessary.Keryn Knight
Follow up to bf5abf1bdcedb15e949db419c61eeec7c88414ea. This also caches the __getitem__ access.
2021-09-23Fixed #33133 -- Fixed handling NullBooleanField in historical migrations.Mariusz Felisiak
Regression in d992f4e3c29a81c956d3d616f0bc19701431b26e.
2021-09-09Fixed #33084 -- Removed incorrect system check for ManyToManyField with ↵Hasan Ramezani
limit_choices_to.
2021-08-06Fixed #32983 -- Added system check for redundant related_name on symmetrical ↵Nick Touran
M2M fields. Since ManyToManyFields defined with `symmetrical=True` do not add a related field to the target model, including a `related_name` argument will never do what the coder likely expects. This makes including a related_name with a symmetrical model raise a system check warning. ticket-32983
2021-07-30Refs #32966 -- Refactored out DateTimeCheckMixin._check_if_value_fixed().Chris Jerdonek
2021-07-30Refs #32966 -- Simplified the _check_fix_default_value() implementations.Chris Jerdonek
2021-07-30Refs #32966 -- Added _to_naive() and _get_naive_now() for use in ↵Chris Jerdonek
DateTimeCheckMixin classes.
2021-07-30Fixed #32966 -- Fixed TimeField.check() crash for timezone-aware times in ↵Chris Jerdonek
default when USE_TZ = True.
2021-07-28Refs #32946 -- Changed internal usage of dynamic Q() objects construction to ↵Keryn Knight
use non-kwargs initialization. This prefers non-kwargs construction of dynamically generated Q() objects to create a single Q() object instead of many and then combining them, where possible.
2021-07-26Fixed #32947 -- Fixed hash() crash on reverse M2M relation when ↵Tom Wojcik
through_fields is a list. Regression in c32d8f33d8e988a376e44997b8f3606d821f305e.
2021-07-22Fixed #32951 -- Removed Query.where_class & co.Nick Pope
Unused since 3caf957ed5eaa831a485abcb89f27266dbf3e82b.
2021-07-15Refs #32508 -- Raised Type/ValueError instead of using "assert" in ↵Daniyal
django.db.models. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-09Fixed #27021 -- Allowed lookup expressions in annotations, aggregations, and ↵Ian Foote
QuerySet.filter(). Thanks Hannes Ljungberg and Simon Charette for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-07Fixed #32840 -- Optimized Field.get_col().Keryn Knight
get_col() used "self" as "output_field" when it was not given, and unnecessarily compared "self" to "self". Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-06-15Fixed #30427, Fixed #16176 -- Corrected setting descriptor in ↵Carlton Gibson
Field.contribute_to_class(). Co-authored-by: Jarek Glowacki <jarekwg@gmail.com>
2021-05-28Fixed #32676 -- Prevented migrations from rendering related field attributes ↵David Wobrock
when not passed during initialization. Thanks Simon Charette for the implementation idea.
2021-05-13Fixed #32718 -- Relaxed file name validation in FileField.Mariusz Felisiak
- Validate filename returned by FileField.upload_to() not a filename passed to the FileField.generate_filename() (upload_to() may completely ignored passed filename). - Allow relative paths (without dot segments) in the generated filename. Thanks to Jakub Kleň for the report and review. Thanks to all folks for checking this patch on existing projects. Thanks Florian Apolloner and Markus Holtermann for the discussion and implementation idea. Regression in 0b79eb36915d178aef5c6a7bbce71b1e76d376d3.
2021-05-04Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads.Florian Apolloner
2021-04-13Corrected typo in Field.deconstruct docstring.Daniel Hahler
2021-04-08Fixed #32620 -- Allowed subclasses of Big/SmallAutoField for DEFAULT_AUTO_FIELD.Adam Johnson
2021-03-23Fixed #32483 -- Fixed QuerySet.values()/values_list() on JSONField key ↵Mariusz Felisiak
transforms with booleans on SQLite. Thanks Matthew Cornell for the report.
2021-02-05Fixed #32411 -- Fixed __icontains lookup for JSONField on MySQL.Hasan Ramezani
2021-01-14Refs #31369 -- Removed models.NullBooleanField per deprecation timeline.Mariusz Felisiak
2020-12-30Fixed #32294 -- Prevented ManyToManyField's hidden related name collisions ↵manav014
between apps.
2020-12-29Added app labels to related fields checks messages E302-E305.Mariusz Felisiak
2020-12-29Used model's Options.label where applicable.Mariusz Felisiak
Follow up to b7a3a6c9ef0a89625881b47594120bca55fa2e49.