How to use Django-based update classes using FileFields

I have a simple model containing a FileField among others. When I use class-based updating, I can change all the fields of the model, and the changes are saved in the database on submit. The one exception is FileField, while it is displayed as part of the form, and I can select the File that I want to upload is not saved.

Question: How can I use FileFields in UpdateViews classes based on classes, is there specific code to handle these fields?

+6
source share
1 answer

Make sure your form is declared as follows:

<form enctype="multipart/form-data" method="post" action="/foo/"> 
+19
source

Source: https://habr.com/ru/post/912168/


All Articles