Пример #1
0
def save_shipping_price_criteria(request, shipping_price_id):
    """Saves the criteria for the shipping price with given id. The criteria
    are passed via request body.
    """
    shipping_price = get_object_or_404(ShippingMethodPrice,
                                       pk=shipping_price_id)

    criteria_utils.save_criteria(request, shipping_price)

    html = [
        [
            "#price-criteria",
            shipping_price_criteria(request, shipping_price_id, as_string=True)
        ],
        [
            "#prices",
            shipping_method_prices(request, shipping_price.shipping_method.id)
        ],
    ]

    result = simplejson.dumps(
        {
            "html": html,
            "message": _(u"Modifications have been changed."),
        },
        cls=LazyEncoder)

    return HttpResponse(result)
Пример #2
0
def save_shipping_method_criteria(request, shipping_method_id):
    """Saves the criteria for the shipping method with given id. The criteria
    are passed via request body.
    """
    shipping_method = lfs_get_object_or_404(ShippingMethod, pk=shipping_method_id)

    criteria_utils.save_criteria(request, shipping_method)

    html = [["#criteria", shipping_method_criteria(request, shipping_method_id)]]

    result = simplejson.dumps({"html": html, "message": _(u"Modifications have been changed.")}, cls=LazyEncoder)

    return HttpResponse(result)
Пример #3
0
def save_discount_criteria(request, id):
    """Saves the criteria for the discount with given id. The criteria
    are passed via request body.
    """
    discount = lfs_get_object_or_404(Discount, pk=id)
    criteria_utils.save_criteria(request, discount)
    criteria = discount_criteria(request, id)

    html = [["#criteria", discount_criteria(request, id)]]

    result = simplejson.dumps({"html": html, "message": _("Modifications have been changed.")}, cls=LazyEncoder)

    return HttpResponse(result)
Пример #4
0
def save_shipping_method_criteria(request, shipping_method_id):
    """Saves the criteria for the shipping method with given id. The criteria 
    are passed via request body.
    """    
    shipping_method = lfs_get_object_or_404(ShippingMethod, pk=shipping_method_id)

    criteria_utils.save_criteria(request, shipping_method)
    
    criteria = shipping_method_criteria(request, shipping_method_id)
    result = {
        "criteria" : criteria,
        "message" : "Modifications have been changed"
    }
    return HttpResponse(simplejson.dumps(result))
Пример #5
0
def save_shipping_method_criteria(request, shipping_method_id):
    """Saves the criteria for the shipping method with given id. The criteria 
    are passed via request body.
    """
    shipping_method = lfs_get_object_or_404(ShippingMethod,
                                            pk=shipping_method_id)

    criteria_utils.save_criteria(request, shipping_method)

    criteria = shipping_method_criteria(request, shipping_method_id)
    result = {
        "criteria": criteria,
        "message": "Modifications have been changed"
    }
    return HttpResponse(simplejson.dumps(result))
Пример #6
0
def save_shipping_price_criteria(request, shipping_price_id):
    """Saves the criteria for the shipping price with given id. The criteria 
    are passed via request body.
    """    
    shipping_price = get_object_or_404(ShippingMethodPrice, pk=shipping_price_id)
    
    criteria_utils.save_criteria(request, shipping_price)
    
    prices = shipping_method_prices(request, shipping_price.shipping_method.id)
    criteria = shipping_price_criteria(request, shipping_price_id, as_string=True)
    result = {
        "criteria" : criteria,
        "prices" : prices,
        "message" : "Modifications have been changed"
    }
    return HttpResponse(simplejson.dumps(result))
Пример #7
0
def save_shipping_price_criteria(request, shipping_price_id):
    """Saves the criteria for the shipping price with given id. The criteria
    are passed via request body.
    """
    shipping_price = get_object_or_404(ShippingMethodPrice, pk=shipping_price_id)

    criteria_utils.save_criteria(request, shipping_price)

    html = [
        ["#price-criteria", shipping_price_criteria(request, shipping_price_id, as_string=True)],
        ["#prices", shipping_method_prices(request, shipping_price.shipping_method.id)],
    ]

    result = simplejson.dumps({"html": html, "message": _(u"Modifications have been changed.")}, cls=LazyEncoder)

    return HttpResponse(result)
Пример #8
0
def save_payment_method_criteria(request, payment_method_id):
    """Saves the criteria for the payment method with given id. The criteria
    are passed via request body.
    """
    payment_method = lfs_get_object_or_404(PaymentMethod, pk=payment_method_id)

    criteria_utils.save_criteria(request, payment_method)

    html = [["#criteria", payment_method_criteria(request, payment_method_id)]]

    result = simplejson.dumps(
        {
            "html": html,
            "message": _(u"Modifications have been changed."),
        },
        cls=LazyEncoder)

    return HttpResponse(result)
Пример #9
0
def save_discount_criteria(request, id):
    """Saves the criteria for the discount with given id. The criteria
    are passed via request body.
    """
    discount = lfs_get_object_or_404(Discount, pk=id)
    criteria_utils.save_criteria(request, discount)
    criteria = discount_criteria(request, id)

    html = [["#criteria", discount_criteria(request, id)]]

    result = simplejson.dumps(
        {
            "html": html,
            "message": _("Modifications have been changed."),
        },
        cls=LazyEncoder)

    return HttpResponse(result)
Пример #10
0
def save_shipping_price_criteria(request, shipping_price_id):
    """Saves the criteria for the shipping price with given id. The criteria 
    are passed via request body.
    """
    shipping_price = get_object_or_404(ShippingMethodPrice,
                                       pk=shipping_price_id)

    criteria_utils.save_criteria(request, shipping_price)

    prices = shipping_method_prices(request, shipping_price.shipping_method.id)
    criteria = shipping_price_criteria(request,
                                       shipping_price_id,
                                       as_string=True)
    result = {
        "criteria": criteria,
        "prices": prices,
        "message": "Modifications have been changed"
    }
    return HttpResponse(simplejson.dumps(result))