mercredi 9 mai 2018

Django json post request parse

My client is passing this json as a post to django server:

data={  'supplier': supplier_name,
        'date': date,
        'payment':payment,
        'materials':[{"name":name,"qtd":qtd,"price":price}
                    {"name":name,"qtd":qtd,"price":price}
                    {"name":name,"qtd":qtd,"price":price}]
}

My django view handles data like this:

supplier=request.POST.get('supplier')
date=request.POST.get('date')

When I try to do this, the materials content is "none":

materials=request.POST.get('materials')

How can get a list use in further code?




Aucun commentaire:

Enregistrer un commentaire