Opened 14 years ago
Closed 14 years ago
#17350 closed New feature (worksforme)
in_bulk should use duck typing so that listy-objects can be used, like ValuesListQuerySet
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.3 |
| Severity: | Normal | Keywords: | queryset, valueslistqueryset, db |
| Cc: | umbrae@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Currently, using a ValuesListQuerySet as a parameter to in_bulk returns an exception, even with flat=True:
AssertionError: in_bulk() must be provided with a list of IDs.
This is due to this line in query.py (line 416 in 1.3) :
assert isinstance(id_list, (tuple, list, set, frozenset)), \
"in_bulk() must be provided with a list of IDs.
Which requires a certain type, rather than just something that can be iterated upon. I think it'd be more valuable if it was just something iterable, like ValuesListQuerySet is.
Note:
See TracTickets
for help on using tickets.
As far as I can tell, this problem no longer exists.
Here are all the occurrences of
assert isinstancein trunk: