Example #1
0
def products(request):
    product_list = m.Product.objects.all()

    data = iterlist({
        'id': elem.id,
        'sku': elem.sku,
        'name': elem.name,
        'stock': elem.stock,
        'type_name': elem.product_type.name,
    } for elem in product_list)

    return StreamingJsonResponse(data, safe=False)
Example #2
0
def products(request):
    product_list = m.Product.objects.all()

    random_summary.labels(a=random.choice("xyz")).observe(random.randint(0, 100))
    random_counter.labels(a=random.choice("xyz")).inc(random.randint(0, 5))
    random_gauge.labels(a=random.choice("xzy")).set(random.random()*100)
    data = iterlist({
        'id': elem.id,
        'sku': elem.sku,
        'name': elem.name,
        'stock': elem.stock,
        'type_name': elem.product_type.name,
    } for elem in product_list)

    return StreamingJsonResponse(data, safe=False)