How do I add a form value to a URL using Django -


i have simple form. has field accepts hostname , submit button. when form submitted app gets info host provided , display user.

what i'd after form submitted have url updated include hostname provided user. example:

http://my-host-checker.com 

becomes

http://my-host-checker.com/acme.com 

also able email second url link can used automatically submit request , results page.

i'm django newbie , appreciate code examples if indeed possible.

the general idea redirect after form data processed.

take @ this example (which shows how send mail).

now, instead of redirecting static page (httpresponseredirect('/thanks/')) should redirect detail view of newly created object.

assumed have view setup detail pages of hosts can direct user get_absolute_url() of newly created object (check permalink docs more information).

httpresponseredirect(new_host.get_absolute_url()) 

Comments