diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 12490c8..cd94bac 100644
a
|
b
|
class ModelAdmin(BaseModelAdmin):
|
601 | 601 | """ |
602 | 602 | obj.save() |
603 | 603 | |
| 604 | def delete_model(self, requet, obj): |
| 605 | """ |
| 606 | Given a model instance delete it from the database. |
| 607 | """ |
| 608 | obj.delete() |
| 609 | |
604 | 610 | def save_formset(self, request, form, formset, change): |
605 | 611 | """ |
606 | 612 | Given an inline formset save it to the database. |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
1119 | 1125 | raise PermissionDenied |
1120 | 1126 | obj_display = force_unicode(obj) |
1121 | 1127 | self.log_deletion(request, obj, obj_display) |
1122 | | obj.delete() |
| 1128 | self.delete_model(request, obj) |
1123 | 1129 | |
1124 | 1130 | self.message_user(request, _('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)}) |
1125 | 1131 | |
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 0550576..3fe83a8 100644
a
|
b
|
templates used by the :class:`ModelAdmin` views:
|
756 | 756 | ``ModelAdmin`` methods |
757 | 757 | ---------------------- |
758 | 758 | |
| 759 | .. warning:: |
| 760 | |
| 761 | ``save_model`` and ``delete_model`` have to save/delete the object, those |
| 762 | methods are not for veto purposes, they just allow you to do some extra |
| 763 | operations. |
| 764 | |
759 | 765 | .. method:: ModelAdmin.save_model(self, request, obj, form, change) |
760 | 766 | |
761 | 767 | The ``save_model`` method is given the ``HttpRequest``, a model instance, |
… |
… |
For example to attach ``request.user`` to the object prior to saving::
|
769 | 775 | obj.user = request.user |
770 | 776 | obj.save() |
771 | 777 | |
| 778 | .. method:: ModelAdmin.delete_model(self, request, obj) |
| 779 | |
| 780 | The ``delete_model`` method is given the ``HttpRequest`` and a model instance. |
| 781 | Use this method to to pre- or post-delete operations. |
| 782 | |
772 | 783 | .. method:: ModelAdmin.save_formset(self, request, form, formset, change) |
773 | 784 | |
774 | 785 | 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 1a939b0..0e9290c 100644
a
|
b
|
database other than that that specified by your router chain, you'll
|
458 | 458 | need to write custom :class:`~django.contrib.admin.ModelAdmin` classes |
459 | 459 | that will direct the admin to use a specific database for content. |
460 | 460 | |
461 | | ``ModelAdmin`` objects have four methods that require customization for |
| 461 | ``ModelAdmin`` objects have five methods that require customization for |
462 | 462 | multiple-database support:: |
463 | 463 | |
464 | 464 | class MultiDBModelAdmin(admin.ModelAdmin): |
… |
… |
multiple-database support::
|
469 | 469 | # Tell Django to save objects to the 'other' database. |
470 | 470 | obj.save(using=self.using) |
471 | 471 | |
| 472 | def delete_model(self, requqest, obj): |
| 473 | # Tell Django to delete objects from the 'other' database |
| 474 | obj.delete(using=self.using) |
| 475 | |
472 | 476 | def queryset(self, request): |
473 | 477 | # Tell Django to look for objects on the 'other' database. |
474 | 478 | return super(MultiDBModelAdmin, self).queryset(request).using(self.using) |