I have a form in which the user selects a few items to display on "the following page". This selection is always unique, and we will store each set of selections made using a model, indexed by the id
as is par with Django models. When the user selects her choices and POST
s using the submit button, I would like for our application to store her selections in the model, and then render a page with the id of the model so that the user can get back to the page she created at any point with a simple GET
request.
For example, the user goes to /coolapp/selectprefs/
, makes a few selections, and clicks submit. The user should then be taken to /coolapp/selections/42
given that when the user submitted and created the record, the record was given an id
of 42
.
What I don't understand is how to send the user to "the following page" as a response (e.g., /coolapp/selections/42
in the above example) after she clicks the submit button. Taking a user to a page of a unique ID based on what she entered seems like a common task (e.g., it will happen when I click the button to submit this question on SO), but I'm not sure how to go about doing it, and would appreciate your advice.