@staff_member_required
def category_delete(request, pk):
    category = get_object_or_404(Category, pk=pk)
    if request.method == 'POST':
        category.delete()
        messages.success(request, category % _('Deleted category %s'))
        root_pk = None
        if category.parent:
            root_pk = category.parent.pk
        if root_pk:
            if request.is_ajax():
                response = {'redirectUrl': reverse(
                    'dashboard:category-list', kwargs={'root_pk': root_pk})}
                return JsonResponse(response)
            return redirect('dashboard:category-list', root_pk=root_pk)
        else:
            if request.is_ajax():
                response = {'redirectUrl': reverse('dashboard:category-list')}
                return JsonResponse(response)
            return redirect('dashboard:category-list')
    ctx = {'category': category,
           'descendants': list(category.get_descendants()),
           'products_count': len(category.products.all())}
    return TemplateResponse(request,
                            'dashboard/category/modal_delete.html',
                            ctx)
dataset/ETHPy150Open mirumee/saleor/saleor/dashboard/category/views.py/category_delete/swapped operands of `%`