diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index dab9170..d125978 100644
a
|
b
|
from django.utils.text import capfirst, get_text_list
|
22 | 22 | from django.utils.translation import ugettext as _ |
23 | 23 | from django.utils.translation import ungettext, ugettext_lazy |
24 | 24 | from django.utils.encoding import force_unicode |
25 | | try: |
26 | | set |
27 | | except NameError: |
28 | | from sets import Set as set # Python 2.3 fallback |
29 | 25 | |
30 | 26 | HORIZONTAL, VERTICAL = 1, 2 |
31 | 27 | # returns the <ul> class for a given radio_admin field |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
577 | 573 | """ |
578 | 574 | obj.save() |
579 | 575 | |
| 576 | def delete_model(self, requet, obj): |
| 577 | """ |
| 578 | Given a model instance delete it from the database. |
| 579 | """ |
| 580 | obj.delete() |
| 581 | |
580 | 582 | def save_formset(self, request, form, formset, change): |
581 | 583 | """ |
582 | 584 | Given an inline formset save it to the database. |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
1061 | 1063 | raise PermissionDenied |
1062 | 1064 | obj_display = force_unicode(obj) |
1063 | 1065 | self.log_deletion(request, obj, obj_display) |
1064 | | obj.delete() |
| 1066 | self.delete_model(request, obj) |
1065 | 1067 | |
1066 | 1068 | self.message_user(request, _('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)}) |
1067 | 1069 | |
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 97e9c8b..b5ded5b 100644
a
|
b
|
that provides the standard appearance is used.
|
739 | 739 | ``ModelAdmin`` methods |
740 | 740 | ---------------------- |
741 | 741 | |
| 742 | .. warning:: |
| 743 | |
| 744 | ``save_model`` and ``delete_model`` have to save/delete the object, those |
| 745 | methods are not for veto purposes, they just allow you to do some extra |
| 746 | operations. |
| 747 | |
742 | 748 | .. method:: ModelAdmin.save_model(self, request, obj, form, change) |
743 | 749 | |
744 | 750 | The ``save_model`` method is given the ``HttpRequest``, a model instance, |
… |
… |
For example to attach ``request.user`` to the object prior to saving::
|
752 | 758 | obj.user = request.user |
753 | 759 | obj.save() |
754 | 760 | |
| 761 | .. method:: ModelAdmin.delete_model(self, request, obj) |
| 762 | |
| 763 | The ``delete_model`` method is given the ``HttpRequest`` and a model instance. |
| 764 | Use this method to to pre- or post-delete operations. |
| 765 | |
755 | 766 | .. method:: ModelAdmin.save_formset(self, request, form, formset, change) |
756 | 767 | |
757 | 768 | The ``save_formset`` method is given the ``HttpRequest``, the parent |
diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt
index 8c42613..ca3e27d 100644
a
|
b
|
database other than ``default``, you need to write custom
|
191 | 191 | :class:`~django.contrib.admin.ModelAdmin` classes that will direct the |
192 | 192 | admin to use a specific database for content. |
193 | 193 | |
194 | | There are four methods that require customization on a ModelAdmin |
| 194 | There are five methods that require customization on a ModelAdmin |
195 | 195 | object:: |
196 | 196 | |
197 | 197 | class MultiDBModelAdmin(admin.ModelAdmin): |
… |
… |
object::
|
202 | 202 | # Tell Django to save objects to the 'other' database |
203 | 203 | obj.save(using=self.using) |
204 | 204 | |
| 205 | def delete_model(self, requqest, obj): |
| 206 | # Tell Django to delete objects from the 'other' database |
| 207 | obj.delete(using=self.using) |
| 208 | |
205 | 209 | def queryset(self, request): |
206 | 210 | # Tell Django to look for objects on the 'other' database |
207 | 211 | return super(MultiDBModelAdmin, self).queryset(request).using(self.using) |