Posts

Showing posts with the label Exclude

exclude() method in Django

You can exclude certain results from the QuerySet using the exclude() method of the manager. For Ex:, you can retrieve all posts published in 2019 whose titles don't start with xyz: Posts.objects.filter(publish__year=2019).exclude(title__startswith='xyz')