1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #31071 -- Disabled insert optimization for primary keys with defaults when loading fixtures.

Model.save_base() is called directly when loading fixtures and assumes
existing rows will be updated. Branching of "raw" allows to maintain
the optimization introduced in #29260 while supporting this edge case.

Regression in 85458e94e3.

Thanks Reupen Shah for the report.
This commit is contained in:
Simon Charette
2019-12-11 22:34:28 -05:00
committed by Mariusz Felisiak
parent 5a68f02498
commit 5779cc938a
4 changed files with 13 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ The following classes are for testing basic data marshalling, including
NULL values, where allowed.
The basic idea is to have a model for each Django data type.
"""
import uuid
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
@@ -257,6 +259,10 @@ class UUIDData(models.Model):
data = models.UUIDField(primary_key=True)
class UUIDDefaultData(models.Model):
data = models.UUIDField(primary_key=True, default=uuid.uuid4)
class FKToUUID(models.Model):
data = models.ForeignKey(UUIDData, models.CASCADE)