1๐
โ
As @Demetris already suggested in the above comment you should use enctype="multipart/form-data"
in the HTML form so:
{% extends 'main.html' %}
{% block content %}
<form action="" method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="user-settings-save" value="submit">
</form>
{% endblock content %}
Note: You can remove the empty
action=""
attribute from HTML form since django always takes current page route.
Note: Function based views are generally written in
snake_case
notcascalCase
, so it is better to rename it asuser_settings
fromuserSettings
.
๐คSunderam Dubey
Source:stackexchange.com