Skip to content
Advertisement

Image is not updating in Django

Please help me. I am trying to update the profile in which username and email are updated but the image dose not. My code is….

profile.html

JavaScript

views.py

JavaScript

forms.py

JavaScript

Advertisement

Answer

I believe your issue lies in views.py.

Firstly, you are checking to see if the method for retrieving the view is POST. If it is not, you are initializing a form with the POST data that is not present. I have simplified that for you below.

Secondly, you are not passing the POST information to the second form, only the files portion. Have you tried changing the p_form to take both parameters like below?

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement