Published
- 1 min read
get a list of ids from queryset django
The solution for this is noted below
get a list of ids from queryset django
Solution
author = Blog.objects.filter(author=author)
ids = author.values_list('pk', flat=True)
# list method get ids without parse the returning queryset
print(list(ids))
Try other methods by searching on the site. That is if this doesn’t work