Skip to content

Instantly share code, notes, and snippets.

@SpencerCooley
Last active January 19, 2016 13:24
Show Gist options
  • Save SpencerCooley/dcd6f951466534b750e7 to your computer and use it in GitHub Desktop.
Save SpencerCooley/dcd6f951466534b750e7 to your computer and use it in GitHub Desktop.
if 'min_price' in data and data['min_price'] and price_filtered:
min_price = data['min_price']
if data['max_price']:
max_price = data['max_price']
if beds == 1:
sqs = sqs.filter(SQ(min_price_1bed__gte=min_price) &
SQ(min_price_1bed__lte=max_price))
elif beds == 2:
sqs = sqs.filter(SQ(min_price_2bed__gte=min_price) &
SQ(min_price_2bed__lte=max_price))
elif beds == 3:
sqs = sqs.filter(SQ(min_price_3bed__gte=min_price) &
SQ(min_price_3bed__lte=max_price))
elif not beds:
one = sqs.filter(SQ(min_price_1bed__gte=min_price) &
SQ(min_price_1bed__lte=max_price))
two = sqs.filter(SQ(min_price_1bed__gte=min_price) &
SQ(min_price_1bed__lte=max_price))
three = sqs.filter(SQ(min_price_1bed__gte=min_price) &
SQ(min_price_1bed__lte=max_price))
#need to merge one, two, and three somehow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment