#31551: TypeError: _bulk_create() got an unexpected keyword argument
'ignore_conflicts'.
-------------------------------------+-------------------------------------
     Reporter:  Shivam Chaurasia     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Many-to-many Fields  |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Ethan Meanor):

 * status:  closed => new
 * version:  3.0 => 3.1
 * resolution:  needsinfo =>


Comment:

 I am having the same issue in 3.1. This happens when calling .add() both
 from Django project files and from the shell. You should be able to
 reproduce it in this project:
 https://github.com/emeanor/wtp/

 Specifically, the error is being generated in /texts/tests.py, by the
 function {{{test_can_be_attached_to_multiple_divisions}}} (currently
 commented out):
 https://github.com/emeanor/wtp/blob/main/texts/tests.py

 {{{
     def test_can_be_attached_to_multiple_divisions(self):
         edition = Edition.objects.create()
         divisions = [Division.objects.create(edition=edition) for i in
 range(3)]

         for division in divisions:
             division.texts.add(self.text) # .add() is the error source.

         self.assertEquals(len(divisions), self.text.division_set.count())

         for division in divisions:
             self.assertIn(division, self.text.division_set)
 }}}


 Trackeback:

 {{{
 Traceback (most recent call last):
   File "/home/ethan/dev/projects/wtp/texts/tests.py", line 41, in
 test_can_be_attached_to_multiple_divisions
     division.texts.add(self.text)
   File "/home/ethan/dev/.venv/wtp/lib/python3.8/site-
 packages/django/db/models/fields/related_descriptors.py", line 950, in add
     self._add_items(
   File "/home/ethan/dev/.venv/wtp/lib/python3.8/site-
 packages/django/db/models/fields/related_descriptors.py", line 1150, in
 _add_items
     self.through._default_manager.using(db).bulk_create([
 TypeError: bulk_create() got an unexpected keyword argument
 'ignore_conflicts'
 }}}

 Note that {{{bulk_create()}}} here does not have the leading underscore.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31551#comment:2>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/066.c14925795c8231d892aa4a36a17f72fe%40djangoproject.com.

Reply via email to