def set_price_filter(request, category_slug):
    req = request.POST if request.method == 'POST' else request.GET
    try:
        min_val = lfs.core.utils.atof(req.get("min", "0"))
    except (ValueError):
        min_val = 0

    try:
        max_val = lfs.core.utils.atof(req.get("max", "99999"))
    except:
        max_val = 0

    try:
        float(min_val)
    except (TypeError, ValueError):
        min_val = "0"

    try:
        float(max_val)
    except (TypeError, ValueError):
        max_val = "0"

    request.session["price-filter"] = {"min": min_val, "max": max_val}

    url = reverse("lfs_category", kwargs={"slug": category_slug})
    return HttpResponseRedirect(url)
Saves the given price filter to session. Redirects to the category with
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/views.py/set_price_filter