0
I plan to pass an array via Ajax to my Django view, but there is always an error
stream_or_string = stream_or_string.read()
Attributeerror: 'Nonetype' Object has no attribute 'read'
$.ajax({
url: 'ajax/',
type: 'POST',
dataType: "json",
data: {disciplina: array_list},
success: function(data) {
//alert("Cadastro realizado com sucesso!");
},
failure: function(data) {
//alert("Ocorreu um erro, realize a operação novamente");
}
}).done(function(data){
//alert(data);
});
view py.
for lista in serializers.deserialize("json", request.POST.get('disciplina')):
idDisciplina = [lista]
In case I do something like that
num=request.POST.get('disciplina')
It still receives if I pass only a single value and not an array
I used deserialize based on what I found, but I did not quite understand its functionality, someone can help ?
I will be testing and I speak if it worked, but I’m still with a doubt to q the use of serializers? If you can use a basic ex would help Mut
– TheuzC