class DeletionMixin
from django.views.generic.edit import DeletionMixin
A mixin providing the ability to delete objects
Descendants
Attributes
Defined in | |
---|---|
success_url = None
|
DeletionMixin |
Methods
def
delete(self, request, *args, **kwargs):
DeletionMixin
¶
def
delete(self, request, *args, **kwargs):
DeletionMixin
¶
Calls the delete() method on the fetched object and then redirects to the success URL.
239 240 241 242 243 244 245 246 | def delete(self, request, *args, **kwargs): """ Calls the delete() method on the fetched object and then redirects to the success URL. """ self.object = self.get_object() self.object.delete() return HttpResponseRedirect(self.get_success_url()) |
def
get_success_url(self):
DeletionMixin
¶
def
get_success_url(self):
DeletionMixin
¶
252 253 254 255 256 257 | def get_success_url(self): if self.success_url: return self.success_url else: raise ImproperlyConfigured( "No URL to redirect to. Provide a success_url.") |
def
post(self, *args, **kwargs):
DeletionMixin
¶
def
post(self, *args, **kwargs):
DeletionMixin
¶
249 250 | def post(self, *args, **kwargs): return self.delete(*args, **kwargs) |