Ticket #11108: contrib-admin-options-py.diff

File contrib-admin-options-py.diff, 893 bytes (added by thomas, 16 years ago)

patch to add ModelAdmin.delete_model() in contrib.admin.options.py

  • contrib/admin/options.py

    old new  
    556556        """
    557557        obj.save()
    558558
     559    def delete_model(self, request, obj):
     560        """
     561        Given a model instance delete it from the database.
     562        """
     563        obj.delete()
     564
    559565    def save_formset(self, request, form, formset, change):
    560566        """
    561567        Given an inline formset save it to the database.
     
    10131019                raise PermissionDenied
    10141020            obj_display = force_unicode(obj)
    10151021            self.log_deletion(request, obj, obj_display)
    1016             obj.delete()
     1022            self.delete_model(request, obj)
    10171023
    10181024            self.message_user(request, _('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)})
    10191025
Back to Top