summaryrefslogtreecommitdiff
path: root/tests/model_fields/models.py
AgeCommit message (Collapse)Author
2025-02-20[5.2.x] Refs #35167 -- Fixed test_bulk_update_custom_get_prep_value() crash ↵Mariusz Felisiak
on databases that don't support primitives in JSONFields. For example on Oracle < 21c. Backport of 7500044a825b3e6695f4f0f9e56d5bdc0c5d7988 from main.
2025-02-18[5.2.x] Fixed #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> Backport of 0bf412111be686b6b23e00863f5d449d63557dbf from main.
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
2015-07-21Fixed #25129 -- Made model instance defaults work with migrations (refs #24919).Tim Graham
2015-07-17Fixed #16501 -- Added an allow_unicode parameter to SlugField.Edward Henderson
Thanks Flavio Curella and Berker Peksag for the initial patch.
2015-05-12[1.8.x] Refs #24698, #24712 -- Forwardported ForeignKey.get_db_prep_value() ↵Abhaya Agarwal
test and release notes. Fixed in master by b68212f539f206679580afbfd008e7d329c9cd31. Forwardport of 290c9d665490d80b0a1b648fb022190d7dc375fc from stable/1.8.x
2015-03-25Fixed #24215 -- Refactored lazy model operationsAlex Hill
This adds a new method, Apps.lazy_model_operation(), and a helper function, lazy_related_operation(), which together supersede add_lazy_relation() and make lazy model operations the responsibility of the App registry. This system no longer uses the class_prepared signal.
2015-02-23Guaranteed removal of temporary files during tests.Aymeric Augustin
Dropped the DJANGO_TEST_TEMP_DIR environment variable. Before this change, proper removal depended on the developer passing dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
2015-02-21Fixed #24376 -- added verbose_name arg to UUIDFieldMichael Angeletti