﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1312	QuerySet.in_bulk demands list, should demand iterable	Simon Willison	Adrian Holovaty	"The QuerySet.in_bulk method currently uses the following to ensure it has been passed a list of IDs:

{{{
def in_bulk(self, id_list):
    assert isinstance(id_list, list), ""in_bulk() must be provided with a list of IDs.""
    assert id_list != [], ""in_bulk() cannot be passed an empty ID list.""
    ...
}}}

This means you can't pass in some other iterable that returns ids, which is a bit of a shame. Suggest doing this instead:

{{{
def in_bulk(self, id_list):
    try:
        iter(id_list)
    except TypeError:
        assert False, ""in_bulk() must be provided with a list of IDs.""
    id_list = list(id_list)
    assert id_list != [], ""in_bulk() cannot be passed an empty ID list.""
    ...
}}}"	enhancement	closed	Database layer (models, ORM)		minor	fixed			Unreviewed	0	0	0	0	0	0
