#36550: AssertionError raised when bulk creation model with composite primary 
key
with auto_now_add field
-------------------------------------+-------------------------------------
     Reporter:  Will-Ruddick         |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted
 * summary:
     AssertionError raised when bulk creation model with composite primary
     key
     =>
     AssertionError raised when bulk creation model with composite primary
     key with auto_now_add field

Comment:

 {{{#!diff
 diff --git a/tests/composite_pk/test_create.py
 b/tests/composite_pk/test_create.py
 index 38ad9690fb..60ad1cc671 100644
 --- a/tests/composite_pk/test_create.py
 +++ b/tests/composite_pk/test_create.py
 @@ -1,7 +1,7 @@
  from django.db import IntegrityError
  from django.test import TestCase, skipUnlessDBFeature

 -from .models import Post, Tenant, User
 +from .models import Post, Tenant, User, TimeStamped


  class CompositePKCreateTests(TestCase):
 @@ -78,6 +78,10 @@ class CompositePKCreateTests(TestCase):
          self.assertEqual(obj_3.pk, (obj_3.tenant_id, obj_3.id))
          self.assertEqual(obj_3.email, "[email protected]")

 +    def test_bulk_create_auto_now_add_primary_key(self):
 +        objs = [TimeStamped(id=1), TimeStamped(id=2), TimeStamped(id=3)]
 +        self.assertEqual(len(TimeStamped.objects.bulk_create(objs)), 3)
 +
      @skipUnlessDBFeature(
          "supports_update_conflicts",
          "supports_update_conflicts_with_target",
 }}}
 Thank you, replicated the error with the above test
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36550#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070198a414488d-067222db-ad37-4f7a-a6a5-8d327aaac0a7-000000%40eu-central-1.amazonses.com.

Reply via email to