summaryrefslogtreecommitdiff
path: root/tests/model_fields/test_generatedfield.py
AgeCommit message (Collapse)Author
2025-12-13Fixed #36765 -- Added support for stored GeneratedFields on Oracle 23ai/26ai ↵Mariusz Felisiak
(23.7+). Thanks Jacob Walls for the review.
2025-09-14Refs #27222 -- Refreshed GeneratedFields values on save() initiated update.Simon Charette
This required implementing UPDATE RETURNING machinery that heavily borrows from the INSERT one.
2025-05-16Fixed #33312 -- Raised explicit exception when copying deferred model instances.Simon Charette
Previously save() would crash with an attempted forced update message, and both save(force_insert=True) and bulk_create() would crash with DoesNotExist errors trying to retrieve rows with an empty primary key (id IS NULL). Implementing deferred field model instance copying might be doable in certain cases (e.g. when all the deferred fields are db generated) but that's not trivial to implement in a backward compatible way. Thanks Adam Sołtysik for the report and test and Clifford for the review.
2025-03-25Fixed #36262 -- Made GeneratedField.db_persist a required key-word argument.Jason Cameron
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-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-04-10Fixed #35350 -- Fixed save() with pk set on models with GeneratedFields.Sarah Boyce
Thanks Matt Hegarty for the report and Simon Charette and Natalia Bidart for the reviews. Regression in f333e35.
2024-04-01Fixed #35344, Refs #34838 -- Corrected output_field of resolved columns for ↵Johannes Westphal
GeneratedFields in aliased tables. Thanks Simon Charette for the review.
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-22Fixed #34985 -- Fixed GeneratedFields.contribute_to_class() crash when apps ↵Mariusz Felisiak
are not populated. Thanks Paolo Melchiorre for the report. Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
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-28Fixed #34877 -- Fixed migrations crash when adding GeneratedField with ↵Paolo Melchiorre
output_field with params.
2023-09-19Isolated test models for GeneratedFields.Mariusz Felisiak
Test regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-09-16Fixed #34842 -- Fixed ModelAdmin.readonly_fields crash with GeneratedFields.Paolo Melchiorre
2023-09-14Fixed #34838 -- Corrected output_field of resolved columns for GeneratedFields.Paolo Melchiorre
Thanks Simon Charette for the implementation idea.
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>