我如何添加image_form到format Django?
表单 - form.serialize()
image_form - 图像
$('#id_submit').click(function(e) {
e.preventDefault();
var form = $('form').serialize();
image_form = $("#id_image")[0].files[0]
var data = {
form: form,
}
$.ajax({
headers: {'X-CSRFToken': '{{ csrf_token }}' },
type: 'POST',
data: data,
})
})
相关分类