[Django]-Django form not being submitted

10πŸ‘

βœ…

I tried your code. Your problem is that the action attribute of your html form tag is set to β€œ/league/”.

Unless reqPage url is actually β€œ/league/”, it won’t work. When i changed action="/league/" to action="" as such:

<HTML lang="en">
<head>
    <title>User Registration</title>
</head>
<body>

    <form method="POST" action="">
        {% csrf_token %} 
        <table>{{ form }}</table>
        <input type="submit" value="Create Account"  />
    </form><br /><br />

</body>
</HTML>

The form did work:

In [3]: UserRegistration.objects.all()
Out[3]: [<UserRegistration: aoeu oeu oeu@aeou.com>]
πŸ‘€jpic

Leave a comment