summaryrefslogtreecommitdiff
path: root/tests/model_fields/models.py
AgeCommit message (Collapse)Author
2026-03-16Fixed #36906 -- Handled coalescing JSON-primitive strings and JSON values on ↵Kanin Kearpimy
Oracle.
2026-01-29Fixed #36847 -- Ensured auto_now_add fields are set on pre_save().Nilesh Kumar Pahari
Regression in 94680437a45a71c70ca8bd2e68b72aa1e2eff337. Refs #27222. During INSERT operations, `field.pre_save()` is called to prepare values for db insertion. The `add` param must be `True` for `auto_now_add` fields to be populated. The regression commit passed `False`, causing `auto_now_add` fields to remain `None` when used by other fields, such as `upload_to` callables. Thanks Ran Benita for the report.
2026-01-28Fixed #36233 -- Avoided quantizing integers stored in DecimalField on SQLite.Samriddha9619
Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2025-12-22Refs #36806 -- Removed unnecessary null=True from GeneratedField in test models.Nilesh Kumar Pahari
Test coverage is preserved because the tests only verify that generated fields can produce NULL values when the source field is nullable. This addresses system check warnings in the test suite after 6025eab3c509b4de922117e16866bbfe0ee99aa6.
2025-12-13Fixed #36765 -- Added support for stored GeneratedFields on Oracle 23ai/26ai ↵Mariusz Felisiak
(23.7+). Thanks Jacob Walls for the review.
2025-10-29Fixed #35381 -- Added JSONNull() expression.Clifford Gama
Thanks Jacob Walls for the review.
2025-02-20Refs #35167 -- Fixed test_bulk_update_custom_get_prep_value() crash on ↵Mariusz Felisiak
databases that don't support primitives in JSONFields. For example on Oracle < 21c.
2025-02-18Fixed #35167 -- Delegated to super() in JSONField.get_db_prep_save().Jacob Walls
Avoids reports of bulk_update() sending Cast expressions to JSONField.get_prep_value(). Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-01-13Fixed #36086 -- Fixed crash when using GeneratedField with non-AutoField pk.Simon Charette
The previous logic was systematically attempting to retrieve last_insert_id even for models without an AutoField primary key when they had a GeneratedField on backends that can't return columns from INSERT. The issue affected MySQL, SQLite < 3.35, and Oracle when the use_returning_into option was disabled and could result in either crashes when the non-auto primary key wasn't an IntegerField subclass or silent misassignment of bogus insert ids (0 or the previous auto primary key insert value) to the first defined generated field value.
2024-08-21Fixed #35695 -- Ensured FileFields use a storage pointing to a temp ↵Hisham Mahmood
directory in model_fields tests.
2024-07-15Refs #35560 -- Corrected required feature flags in ↵Mariusz Felisiak
GeneratedModelUniqueConstraint.
2024-07-04Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for constraints.Mark Gensler
Accessing generated field values on unsaved models caused a crash when validating CheckConstraints and UniqueConstraints with expressions.
2024-05-22Fixed #35472 -- Used temporary directory in test_imagefield.NoReadTests.Sarah Boyce
2024-05-22Fixed #35139 -- Prevented file read after ImageField is saved to storage.John Parton
2024-01-19Fixed #35127 -- Made Model.full_clean() ignore GeneratedFields.Mariusz Felisiak
Thanks Claude Paroz for the report. Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-12-08Fixed #35019 -- Fixed save() on models with both GeneratedFields and ↵Sarah Boyce
ForeignKeys. Thanks Deb Kumar Das for the report. Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-12-07Fixed #35024 -- Fixed model instance creation crash on ↵Mariusz Felisiak
GeneratedField.output_field with backend converters. Regression in d9de74141e8a920940f1b91ed0a3ccb835b55729. This is a long standing issue, however it caused a crash of GeneratedFields for all output fields that have backend-specific converters when the RETURNING clause is not supported (MySQL and SQLite < 3.35). That's why severity was exacerbated.
2023-11-14Fixed #34944 -- Made GeneratedField.output_field required.Mariusz Felisiak
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-11-02Refs #31300 -- Allowed testing GeneratedField without collation.Tim Graham
CockroachDB and Snowflake don't support it.
2023-09-14Fixed #24561 -- Added support for callables on model fields' choices.Natalia
2023-09-07Fixed #31300 -- Added GeneratedField model field.Jeremy Nauta
Thanks Adam Johnson and Paolo Melchiorre for reviews. Co-Authored-By: Lily Foote <code@lilyf.org> Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-30 Fixed #31262 -- Added support for mappings on model fields and ↵Nick Pope
ChoiceField's choices.
2023-08-22Added tests for model field's choices iterator/iterable values.Natalia
2023-03-21Fixed #34388 -- Allowed using choice enumeration types directly on model and ↵T. Franzel
form fields.
2023-02-01Refs #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
2022-08-23Removed unused path variable in model_fields tests.Claude Paroz
2022-06-03Removed obsolete assertions in BooleanFieldTests.test_return_type().Mariusz Felisiak
Added in e9bbdb39de3047761fa8d03d5241eccd571093ff. Obsolete since e9103402c0fa873aea58a6a11dba510cd308cb84.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-01-14Refs #31369 -- Removed models.NullBooleanField per deprecation timeline.Mariusz Felisiak
2020-11-27Fixed #25534, Fixed #31639 -- Added support for transform references in ↵Ian Foote
expressions. Thanks Mariusz Felisiak and Simon Charette for reviews.
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-08-05Fixed #28393 -- Added helpful error messages for invalid ↵Diederik van der Boor
AutoField/FloatField/IntegerField values. Co-authored-by: Diederik van der Boor <vdboor@edoburu.nl> Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2019-03-23Removed redundant model field choices tests.Matthias Kestenholz
2019-03-17Refs #12663 -- Fixed reference to nonexistent field in model_fields tests.Simon Charette
2019-01-30Fixed #30076 -- Added Model.get_FOO_display() even if field's choices are empty.Joshua Cannon
2018-03-20Fixed #29227 -- Allowed BooleanField to be null=True.Tim Graham
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2017-11-13Simplified choices iterators in tests.model_fields.models.Sergey Fedoseev
2017-08-31Fixed #28543 -- Prevented ManyToManyField.value_from_object() from being lazy.Tim Graham
Previously, it was a QuerySet which could reevaluate to a new value if the model's data changes. This is inconsistent with other Field.value_from_object() methods. This allows reverting the fix in the admin for refs #27998.
2017-05-10Decreased max_length for char fields unless absolutely needed. (#8485)Florian Apolloner
2017-03-04Refs #27795 -- Removed unneeded force_text callsClaude Paroz
Thanks Tim Graham for the review.
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed most of remaining six usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-17Refs #26154 -- Removed deprecated CommaSeparatedIntegerField.Tim Graham
2016-11-14Fixed E305 flake8 warnings.Ramin Farajpour Cami
2016-10-28Fixed #27188 -- Allowed using unique=True with FileField.Michael Scott
Thanks Tim Graham for the initial patch.
2016-03-23Split model_fields tests into different files.Tim Graham
2015-12-03Fixed many spelling mistakes in code, comments, and docs.Josh Soref
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField