am using Django and database is mysql , when am printing id from row its printing { id: 45 } , but I only need result 45...someone can help?

itemList = todoitem.objects.filter(content__in=wordlist).values("id")

1 Answers

Willem Van Onsem On Best Solutions

You can make a values_list(..) [Django-doc] with flat=True as parameter:

itemList = todoitem.objects.filter(
).values_list('id', flat=True)

Note that this is not a list, it is a QuerySet. The items in the queryset are however ints here, not dictionaries, nor lists.