mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #29260 -- Skipped an UPDATE when adding a model instance with primary key that has a default.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e9f74f53cc
commit
85458e94e3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user