This is an old revision of the document!
Models
Methods, tips, and tricks for working with Django Models
Query
from ..models import Post # all posts posts = Post.objects.all() # filtered by field posts = Post.objects.filter(pub_date__year=2020) # can chain additional .filter() # queries are done lazily and won't be ran until necessary posts = posts.filter(pub_date__month=12) print(posts) # now the query actually runs