Background : I have a simple model form with a image field.
class XYZForm(ModelForm): class Meta: model = XYZ fields = ( 'file',) The model is
class XYZ(models.Model): url = models.URLField(null = True) file = models.ImageField(upload_to=get_photo_storage_path, null = True) Problem: I am submitting this form via ajax. But this form is not validating, as the file is not being stored.Is there a particular way of submitting forms with files via ajax ?
P.S. :- request.FILES is empty in the view, where the form is being submitted