Skip to content

Instantly share code, notes, and snippets.

@afroisalreadyinu
Created November 3, 2011 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afroisalreadyinu/1336189 to your computer and use it in GitHub Desktop.
Save afroisalreadyinu/1336189 to your computer and use it in GitHub Desktop.
Product query examples
product = Product(color='red', size='small', weight='light')
pq = BasicProductQuery(color='red')
assert product in pq
assert product not in ~pq
SmallAndLight = BasicProductQuery(size='small') & BasicProductQuery(weight='light')
assert product in SmallAndLight
SmallAndLightOrNotRed = SmallAndLight | ~BasicProductQuery(color='red')
product2 = Product(size='big', color='blue', weight='heavy')
assert product2 in SmallAndLightOrNotRed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment