Fixed #29260 -- Skipped an UPDATE when adding a model instance with primary key that has a default.

This commit is contained in:
Hasan Ramezani 2019-08-17 15:30:29 +02:00 committed by Mariusz Felisiak
parent e9f74f53cc
commit 85458e94e3
3 changed files with 24 additions and 1 deletions

View file

@ -3,6 +3,8 @@ Bare-bones model
This is a basic model with only two non-primary-key fields.
"""
import uuid
from django.db import models
@ -40,3 +42,7 @@ class SelfRef(models.Model):
# This method intentionally doesn't work for all cases - part
# of the test for ticket #20278
return SelfRef.objects.get(selfref=self).pk
class PrimaryKeyWithDefault(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)