From 8287fd49151b1b99045efbf3de8ef911d63c5f45 Mon Sep 17 00:00:00 2001 From: Bendeguz Csirmaz Date: Fri, 10 Jan 2025 08:44:10 +0100 Subject: Refs #36064 -- Added test that falsey primary key default/db_default value skips an update query on save. This adds test coverage for logic change in 9fa4d07ce0729850661a31a6b37c6b48f13d2266. --- tests/basic/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/basic/models.py') diff --git a/tests/basic/models.py b/tests/basic/models.py index 236884f4cc..1e6059ee88 100644 --- a/tests/basic/models.py +++ b/tests/basic/models.py @@ -57,5 +57,13 @@ class PrimaryKeyWithDbDefault(models.Model): uuid = models.IntegerField(primary_key=True, db_default=1) +class PrimaryKeyWithFalseyDefault(models.Model): + uuid = models.IntegerField(primary_key=True, default=0) + + +class PrimaryKeyWithFalseyDbDefault(models.Model): + uuid = models.IntegerField(primary_key=True, db_default=0) + + class ChildPrimaryKeyWithDefault(PrimaryKeyWithDefault): pass -- cgit v1.3