[Answer]-Django: passing form input to the url

1👍

You shouldn’t be configuring your action url in this manner. And the user POST-ed number 123 is passed in to your view function as request.POST['number'] without you specifying it in the action url.

Your action url can simply be {% url 'send_details' %} corresponding to a url definition that is

    url(r'^mysite/details/$',
    'send_details',
    name='send_details'),

And your send_details view function will receive request.POST['number'] when the user submits it.

There’s no necessity to have the number in your template as a context variable.

Leave a comment