code: def purge_objects(self, request):
          
  
          def truncate_table(model):
              if settings.TRUNCATE_TABLE_SQL_STATEMENT:
                  from django.db import connection
                  sql = settings.TRUNCATE_TABLE_SQL_STATEMENT.format(db_table=model._meta.db_table)
                  cursor = connection.cursor()
                  cursor.execute(sql)
              else:
                  model.objects.all().delete()
  
          modeladmin = self
          opts = modeladmin.model._meta
  
          # Check that the user has delete permission for the actual model
          if not request.user.is_superuser:
             raise PermissionDenied
          if not modeladmin.has_delete_permission(request):
              raise PermissionDenied
  
          # If the user has already confirmed or cancelled the deletion,
          # (eventually) do the deletion and return to the change list view again.
          if request.method == 'POST':
              if 'btn-confirm' in request.POST:
                  try:
                      n = modeladmin.model.objects.count()
                      truncate_table(modeladmin.model)
                      modeladmin.message_user(request, _("Successfully removed %d rows" % n), messages.SUCCESS);
                  except Exception as e:
                      modeladmin.message_user(request, _(u'ERROR') + ': %r' % e, messages.ERROR)
              else:
                  modeladmin.message_user(request, _("Action cancelled by user"), messages.SUCCESS);
              return HttpResponseRedirect(reverse('admin:%s_%s_changelist' % (opts.app_label, opts.model_name)))
  
          context = {
              "title": _("Purge all %s ... are you sure?") % opts.verbose_name_plural,
              "opts": opts,
              "app_label": opts.app_label,
          }
  
          # Display the confirmation page
          return render(
              request,
              'admin/easyaudit/purge_confirmation.html',
              context
          )
docs: Removes all objects in this table.
          This action first displays a confirmation page;
          next, it deletes all objects and redirects back to the change list.