O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required