[Fixed]-Get Form values in Python using Django framework

1👍

Assign a name to each input

<form action="/login/" method="post">
    {% csrf_token %}
    <input type="text" id="USERNAME" class="text" name="USERNAME" value="USERNAME" >
    <input type="password" id="Password" value="Password" name="Password" >
    <div class="submit">
        <input type="submit" onclick="myFunction()" value="LOGIN">
    </div>  
    <p><a href="#">Forgot Password ?</a></p>
</form>

0👍

HTML form elements always need a name attribute, otherwise the browser won’t have any way of sending them to the backend. It’s that attribute that is the key in the POST dict.

Note that any formatting you can do with HTML on its own you can also do with Django forms; you really should use them in most circumstances.

0👍

Please add the HTML attribute using name for every form component.

Leave a comment