18.8.2 Automating Startup
Selection in NewsLink
Forms
To create a new NewsLink
object, a user will first browse to a Startup
’s detail page and then click the Add Article
link to be brought to the NewsLinkCreate
view. The form will promptly ask the user which Startup
he or she would like to create a NewsLink
for. That’s really silly, not only because we just came from the Startup
we want to create a NewsLink
for but also because the slug
of the Startup
is now in the URL!
There are two ways to fix this problem. In the first, we automatically infer the Startup
without any outside intervention. In the second, we use a hidden field on the form to submit the slug of the Startup
to the form.
18.8.2.1 Inferring the Startup
The slug of the Startup
we ...
Get Django Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.