Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #ids #queryset #django
ADD COMMENT
Topic
Name
8+2 =