def product_customers()

in opbeans/views.py [0:0]


def product_customers(request, pk):
    try:
        limit = int(request.GET.get('count', 1000))
    except ValueError:
        limit = 1000
    customers_list = m.Customer.objects.filter(
        orders__orderline__product_id=pk
    ).distinct().values(
        'id', 'full_name', 'company_name', 'email', 'address',
        'postal_code', 'city', 'country'
    )[:limit]
    return JsonResponse(list(customers_list), safe=False)