Skip to content

Instantly share code, notes, and snippets.

@valerybriz
Last active May 2, 2019 21:49
Show Gist options
  • Save valerybriz/e3d7c2aa2fe1ec90d5245b18e9a7bda6 to your computer and use it in GitHub Desktop.
Save valerybriz/e3d7c2aa2fe1ec90d5245b18e9a7bda6 to your computer and use it in GitHub Desktop.
example query
user_query = User.objects.filter(name="Ana") # Filter the users by the name "Ana"
user_query = user_query.filter(age__lte=50) # Then get only the users where the age is less than 50
user_query = user_query.exclude(email__isnull=True) # And exclude the users that doesn't have an email
print(user_query)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment