Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

queryset to list python

from .models import Article

articles = Article.objects.all()

# This will return a queryset type
print(type(articles))

# Convert articles queryset to a python's list type
articles_list = list(articles)

# This will return a list type
print(type(articles_list))
Source by raturi.in #
 
PREVIOUS NEXT
Tagged: #queryset #list #python
ADD COMMENT
Topic
Name
5+6 =