def filter_by_duration(): """factor duration in""" duration = request.args.get("duration") session["duration"] = duration return functions.get_all_matching_listings()
def filter_by_price(): """update user's price cap and return listings that match""" price_cap = request.args.get("price_cap") session["price_cap"] = price_cap return functions.get_all_matching_listings()
def remove_specific(): """removes clicked filter""" f = request.args.get("filter") f = f[7:] del session[f] return functions.get_all_matching_listings()
def filter_by_start_date(): """only return listings with start dates within a month""" start_dates = request.args.get("start_dates") start_dates = start_dates.split("|") session["start_dates"] = start_dates return functions.get_all_matching_listings()
def filter_by_neighborhoods(): """only return listings in neighborhoods of interest""" neighborhoods = request.args.get("neighborhoods") neighborhoods = neighborhoods.split("|") session["neighborhoods"] = neighborhoods return functions.get_all_matching_listings()
def remove_all_filters(): """removes all filters""" for key in session.keys(): if key != "current_user": del session[key] print session return functions.get_all_matching_listings()
def filter_by_pets(): """only return listings with the correct preference on allowing pets""" pets = request.args.get("pets") if pets == "yes": session["pets"] = True else: session["pets"] = False return functions.get_all_matching_listings()
def filter_by_roommates(): """only return listings with roommates or without depending on filter choice""" roommates = request.args.get("roommates") print roommates if roommates == "yes": session["roommates"] = True else: session["roommates"] = False return functions.get_all_matching_listings()
def get_all_listings_json(): """get all active listings in a user's state""" return functions.get_all_matching_listings()
def filter_by_friends(): """only return listings with mutual friends""" session["friends"] = True return functions.get_all_matching_listings()
def filter_by_laundry(): """only return listings w laundry""" session["laundry"] = True return functions.get_all_matching_listings()