def get_valid_discounts(request, product=None):
    discounts = []
    for discount in Discount.objects.filter(active=True):
        if discount.is_valid(request, product):
            discounts.append({
                "id": discount.id,
                "name": discount.name,
                "sku": discount.sku,
                "price_net": discount.get_price_net(request, product),
                "price_gross": discount.get_price_gross(request, product),
                "tax": discount.get_tax(request, product)
            })

    return discounts
Utility function to quickly set plot parameters.
dataset/ETHPy150Open diefenbach/django-lfs/lfs/discounts/utils.py/get_valid_discounts--crossover with--dataset/ETHPy150Open ggventurini/python-deltasigma/deltasigma/_figureMagic.py/figureMagic