Created
October 15, 2018 04:35
-
-
Save sanjaykrishnan/941f302d75e1195e6b83422fc33e3fa3 to your computer and use it in GitHub Desktop.
filtering by excluding a type of objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myapp.models import Entry | |
from django.db.models import Q | |
Entry.objects.filter(~Q(id = 3)) | |
#[<Entry: Entry object>, <Entry: Entry object>, <Entry: Entry object>, ...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment