1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

Fixed #36064 -- Skipped an UPDATE when adding a model instance with a composite primary key with default values.

This commit is contained in:
Bendeguz Csirmaz
2025-01-10 08:47:10 +01:00
committed by Sarah Boyce
parent 8287fd4915
commit 5851605863
3 changed files with 17 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
import uuid
from django.db import models
@@ -46,8 +48,8 @@ class Comment(models.Model):
class Post(models.Model):
pk = models.CompositePrimaryKey("tenant_id", "id")
tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE)
id = models.UUIDField()
tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE, default=1)
id = models.UUIDField(default=uuid.uuid4)
class TimeStamped(models.Model):