9.4.3 Webpages to Delete Startup and Tag Objects

We implemented ObjectCreateMixin and ObjectUpdatedMixin. It should come as no surprise that we’re about to implement ObjectDeleteMixin (also in organizer/utils.py).

Whereas implementing ObjectCreateMixin and ObjectUpdatedMixin was straightforward, ObjectDeleteMixin requires a little bit more thought.

As shown in Example 9.80, we first need to be able to identify what kind of object we are deleting, so we start by defining a model attribute on the class. In the case of get(), we need to render a template, so we add the template_name attribute to our class too. For the post() method, we won’t be using the template, because our object has been deleted. We instead need a page to redirect to, so 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.