[Answered ]-Custom django comments

2πŸ‘

βœ…

2 things are necessary for your system to work:

  1. The tag has an enctype attribute allowing file uploads, e.g. <form enctype="multipart/form-data" method="post" action="">, or the browser will not send the file

  2. The form is instanciated with both request.POST and request.FILES, e.g. form = form_class(request.POST, request.FILES). Else the FileField will not have any value.

So really what’s missing from your topic are:

  1. The form HTML and

  2. The view python code, hint: make sure you inspect request.FILES there BTW

For me to make a perhaps more specific answer.

πŸ‘€jpic

Leave a comment