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
Post.objects.all()
# filtered by field
Post.objects.filter(pub_date__year=2020) # can chain additional .filter()