return catalog materials when cat data is fetched
This commit is contained in:
@ -33,7 +33,11 @@ def catalogedit(request, id=0):
|
||||
@login_required
|
||||
def get_catalog(request, id):
|
||||
cat = get_object_or_404(Catalog, Q(id=id) & (Q(owner=request.user) | Q(public=True)))
|
||||
return JsonResponse(cat.data, safe=False)
|
||||
prods = cat.products()
|
||||
return JsonResponse({
|
||||
'catalog': cat.data,
|
||||
'products': [p.serialize() for p in prods],
|
||||
})
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
|
||||
Reference in New Issue
Block a user