9.4 Webpages for Deleting Objects

To delete an object, we need to identify it. That’s it. There’s no data validation, and no need for a form. Our webpages are thus much simpler and won’t use any of the forms we programmed in Chapter 7.

Our webpages to delete objects implement a two-step process. When the user requests the webpage (via the HTTP GET method), identifying the object via the URL, we first prompt the user to confirm his or her desire to delete the object. This HTML form then requests the page again, this time using the HTTP POST method, causing our view to delete the object. Our state machine for our view is printed in Table 9.11.

Table 9.11: View States for Deleting Objects

It’s worth being security minded here. Have we just ...

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.