@permission_required("core.manage_shop")
def shipping_price_criteria(request, shipping_price_id, as_string=False,
    template_name="manage/shipping_methods/shipping_price_criteria.html"):
    shipping_price = get_object_or_404(ShippingMethodPrice, pk=shipping_price_id)

    criteria = []
    position = 0
    for criterion in shipping_price.get_criteria():
        position += 10
        criterion_html = criterion.render(request, position)
        criteria.append(criterion_html)

    dialog = render_to_string(template_name, RequestContext(request, {
        "shipping_price": shipping_price,
        "criteria": criteria,
    }))

    if as_string:
        return dialog
    else:
        html = [["#dialog", dialog]]

        result = json.dumps({
            "html": html,
            "open-dialog": True,
        }, cls=LazyEncoder)

        return HttpResponse(result, content_type='application/json')


# Actions
Add the given translations to the catalog.
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/shipping_price_criteria--crossover with--dataset/ETHPy150Open lad1337/XDM/site-packages/babel/support.py/Translations.add