@permission_required("core.manage_shop")
@require_POST
def update_properties(request, product_id):
    ppv_type = int(request.POST.get("type"))
    product = get_object_or_404(Product, pk=product_id)
    ProductPropertyValue.objects.filter(product=product_id, type=ppv_type).delete()

    # Update property values
    for key in request.POST.keys():
        if not key.startswith("property"):
            continue

        _property, property_group_id, property_id = key.split("-")
        if property_group_id == '0':
            property_group_id = None
        prop = get_object_or_404(Property, pk=property_id)

        for value in request.POST.getlist(key):
            if prop.is_valid_value(value):
                # we have to use get_or_create because it is possible that we get same property values twice, eg.
                # if we have a SELECT typ property assigned to two different groups, and both these groups bound
                # to the product. In this case we will have same property shown twice at management page
                ProductPropertyValue.objects.get_or_create(product=product,
                                                           property_group_id=property_group_id,
                                                           property=prop,
                                                           value=value,
                                                           type=ppv_type)
    update_product_cache(product)

    url = reverse("lfs_manage_product", kwargs={"product_id": product_id})
    return HttpResponseRedirect(url)
Updates properties for product with passed id.
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/product/properties.py/update_properties