Search code examples
djangodjango-queryset

What is a Django QuerySet?


When I do this,

>>> b = Blog.objects.all()
>>> b

I get this:

>>>[<Blog: Blog Title>,<Blog: Blog Tile>]

When I query what type b is,

>>> type(b)

I get this:

>>> <class 'django.db.models.query.QuerySet'>

What does this mean? Is it a data type like dict, list, etc?

An example of how I can build data structure like a QuerySet will be appreciated.

I would want to know how Django builds that QuerySet (the gory details).


Solution

  • Yes, it's just another type, built like every other type.