mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
[5.0.x] Fixed #35024 -- Fixed model instance creation crash on GeneratedField.output_field with backend converters.
Regression ind9de74141e. 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 of5b3b791e90from main
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user