Receiving Post Json in Django FrameWork

0

If I send a post like this:

data={  'supplier': supplier_name,
        'date': date,
        'payment':payment,
        'material':[{"name":"tubo","qtd":3,"price":3},{"name":"calha","qtd":4,"price":5}]
} 
$.ajax({
    type:"POST",
    url:"{% url 'validate_purchase' %}",
    data: data,
    dataType: 'json',
    success: function(data){
    }
});

In the view django if you do this, it works perfectly:

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

However if you do this, get returns "none":

payment=request.POST.get('material')
    
asked by anonymous 09.05.2018 / 21:30

0 answers