@permission_required("core.manage_shop")
@require_POST
def update_property_groups(request, product_id):
    selected_group_ids = request.POST.getlist("selected-property-groups")
    product = Product.objects.get(pk=product_id)

    for property_group in PropertyGroup.objects.all():
        # if the group is within selected groups we try to add it to the product
        # otherwise we try do delete it
        if str(property_group.id) in selected_group_ids:
            try:
                property_group.products.get(pk=product_id)
            except ObjectDoesNotExist:
                property_group.products.add(product_id)
        else:
            property_group.products.remove(product_id)
            product_removed_property_group.send(sender=property_group, product=product)

    update_product_cache(product)

    url = reverse("lfs_manage_product", kwargs={"product_id": product_id})
    return HttpResponseRedirect(url)
Grow current window
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/product/properties.py/update_property_groups--crossover with--dataset/ETHPy150Open qtile/qtile/libqtile/layout/xmonad.py/MonadTall.cmd_grow