skip to Main Content

cant upload multiple images djago – ajax – Jquery ajax

I'm trying to upload multiple images with ajax request, i'm using modelformset_factory to upload several images , here is my code : class Document(models.Model): booking =models.ForeignKey(Booking,on_delete=models.PROTECT) docs = models.ImageField(upload_to=upload_docs) my forms.py class UploadDocumentsForm(forms.ModelForm): class Meta: model = Document fields =…

VIEW QUESTION

Csrftoken is not defined – Jquery ajax

I'm using the following code as recommended by the documentation: function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $("#formTabla").submit(function(event){ event.preventDefault(); var formData = new FormData(this); $.ajax({ beforeSend: function(xhr, settings) { if (!csrfSafeMethod(settings.type) &&…

VIEW QUESTION
Back To Top
Search