I am trying to use in_bulk method, although something goes wrong
First I pick values into list that I need to select in bulk:
states = StateObjectRelation.objects.filter(state=int(3), content_type=int(ctype.id))
Then convert them to list:
list = values_list('content_id', flat=True)
Now selecting the items in_bulk:
projects = Project.objects.in_bulk(list)
Give me the following error:
Exception Value:
in_bulk() must be provided with a list of IDs.
If i print out the values that are in list I get the following:
>>> print list
[1L]
>>> print list.values()
[{'state_id': 3L, 'content_id': 1L, 'id': 1L, 'content_type_id': 29L}]
listis a name of built-in list type, it's a very bad idea to name variable like that.