9.2 Webpages for Creating Objects
We start by using the forms we programmed in Chapter 7: Allowing User Input with Forms to create objects in webpages. We first implement a function view, tag_create(), and we do so slowly, because programming a view with a form can be tricky, and getting it wrong can result in a lot of debugging. While not my favored method for implementing form-handling views, the code in the tag_create() view is commonly seen in material related to Django, because it is the code that Django’s documentation uses to introduce form handling in views. Fully understanding this code is thus very useful and serves as a stepping-stone to implementing TagCreate, which uses more explicit code to handle forms and user data.
With a fundamental ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access