class DeletionMixin
from django.views.generic.edit import DeletionMixin
Provide 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
                                
                                ¶
                            Call the delete() method on the fetched object and then redirect to the success URL.
| 220 221 222 223 224 225 226 227 228 | def delete(self, request, *args, **kwargs): """ Call the delete() method on the fetched object and then redirect to the success URL. """ self.object = self.get_object() success_url = self.get_success_url() self.object.delete() return HttpResponseRedirect(success_url) | 
                            
                                
                                    def
                                    get_success_url(self):
                                
                                
                                    DeletionMixin
                                
                                ¶
                            
                        
                        
                                    def
                                    get_success_url(self):
                                
                                
                                    DeletionMixin
                                
                                ¶
                            | 234 235 236 237 238 | def get_success_url(self): if self.success_url: return self.success_url.format(**self.object.__dict__) else: raise ImproperlyConfigured("No URL to redirect to. Provide a success_url.") | 
                            
                                
                                    def
                                    post(self, request, *args, **kwargs):
                                
                                
                                    DeletionMixin
                                
                                ¶
                            
                        
                        
                                    def
                                    post(self, request, *args, **kwargs):
                                
                                
                                    DeletionMixin
                                
                                ¶
                            | 231 232 | def post(self, request, *args, **kwargs): return self.delete(request, *args, **kwargs) |