[Answered ]-Django form.save() does not update database

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 always takes current page route.

Note: Function based views are generally written in snake_case not cascalCase, so it is better to rename it as user_settings from userSettings.

๐Ÿ‘คSunderam Dubey

Leave a comment