Skip to content Skip to sidebar Skip to footer

Django Contact Form Attachment Showing 'This Field Is Required.' What Am I Doing Wrong?

Views.py from django.conf import settings from django.core.mail import EmailMessage,send_mail, BadHeaderError from django.http import HttpResponse, HttpResponseRedirect from django

Solution 1:

You need to pass FILES into the form as well, since it has a file field:

    form = ContactForm(request.POST, request.FILES)

This is all explained in the documentation for uploading files.


Post a Comment for "Django Contact Form Attachment Showing 'This Field Is Required.' What Am I Doing Wrong?"