Opened 5 years ago
Last modified 5 years ago
#31282 closed Bug
RelatedManager.set(..) no longer accepts a list of PKs — at Version 1
Reported by: | Yu Li | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 3.0 |
Severity: | Release blocker | Keywords: | |
Cc: | Tobias Kunze | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
>>> i = ProductImage.objects.get(pk=100) >>> p.images.set([100]) Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python3.8/dist-packages/django/db/models/fields/related_descriptors.py", line 750, in set self.add(*objs, bulk=bulk) File "/usr/local/lib/python3.8/dist-packages/django/db/models/fields/related_descriptors.py", line 656, in add check_and_update_obj(obj) File "/usr/local/lib/python3.8/dist-packages/django/db/models/fields/related_descriptors.py", line 648, in check_and_update_obj raise TypeError("'%s' instance expected, got %r" % ( TypeError: 'ProductImage' instance expected, got 100
Note:
See TracTickets
for help on using tickets.
However, this works fine: