Answers for "how to get the ids of all objects in django"

0

get a list of ids from queryset django

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))
Posted by: Guest on September-14-2020

Code answers related to "how to get the ids of all objects in django"

Python Answers by Framework

Browse Popular Code Answers by Language