Django 2 by Example
上QQ阅读APP看书,第一时间看更新

Using exclude()

You can exclude certain results from your QuerySet using the exclude() method of the manager. For example, we can retrieve all posts published in 2017 whose titles don't start with Why:

Post.objects.filter(publish__year=2017) \
.exclude(title__startswith='Why')