diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-07 20:50:18 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-07 20:50:48 +0100 |
| commit | 415a08a5283a0f76408ec23c6f6af4a0002d7651 (patch) | |
| tree | 01332c74cfabed7cb5695fc5300007a8383e3e45 /tests/model_fields/models.py | |
| parent | 454fd50efb4b6bba54abdbcc01507190c780382f (diff) | |
[5.0.x] Fixed #35024 -- Fixed model instance creation crash on 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.
Backport of 5b3b791e9046461901df3898be8544e14d91b931 from main
Diffstat (limited to 'tests/model_fields/models.py')
| -rw-r--r-- | tests/model_fields/models.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index b4b7b5bd4c..aea02964e2 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -482,6 +482,18 @@ class UUIDGrandchild(UUIDChild): pass +class GeneratedModelFieldWithConverters(models.Model): + field = models.UUIDField() + field_copy = models.GeneratedField( + expression=F("field"), + output_field=models.UUIDField(), + db_persist=True, + ) + + class Meta: + required_db_features = {"supports_stored_generated_columns"} + + class GeneratedModel(models.Model): a = models.IntegerField() b = models.IntegerField() |
