skillfed

django-soft-delete

Soft delete models, managers, queryset for Django

django-soft-delete v1.0.23 135.0K downloads/30d#11,456 on PyPI107
Permissive license MIT Active released

What it is and what it does

Django Soft Delete provides an abstract base model and manager classes that implement logical deletion—marking records as deleted without removing them from the database. When you inherit from the abstract model, your model automatically gains `is_deleted` and `deleted_at` fields, plus three managers: `objects` (shows only alive records), `deleted_objects` (shows only deleted records), and `global_objects` (shows all records). Calling `.delete()` on a soft-deleted model marks it as deleted; calling `.hard_delete()` removes it permanently. The package handles cascading soft deletes when related models also inherit from the same abstract model.

This is useful for audit trails, recovery workflows, and applications where data should be recoverable after deletion. It integrates with django's standard ORM and migration system, requiring only that you add the package to `INSTALLED_APPS` and run migrations. The library does not interfere with standard django relationships, though hard deletion of parent records will hard-delete children unless they are also soft-delete models.

Use it for:

  • Implement audit trails where deleted records remain queryable for compliance or recovery purposes.
  • Build admin interfaces that allow users to restore accidentally deleted content without database recovery.
  • Maintain referential integrity in related models by soft-deleting parents and children together while preserving the data.
  • Filter out inactive or archived records from default queries while keeping them available for reporting or historical analysis.
  • Support multi-tenant applications where soft deletion prevents accidental data loss across shared infrastructure.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds soft deletion to Django models by marking records as deleted rather than removing them from the database, with automatic `is_deleted` and `deleted_at` fields plus managers to query alive, deleted, or all objects.

Yes. Django Soft Delete is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and solves a common Django pattern with minimal friction. Install it if your application needs recoverable deletion, audit trails, or soft-delete cascading. Skip it only if you have no use for logical deletion or prefer to implement the pattern yourself.

Install

django-soft-delete on PyPI

pip

pip install django-soft-delete

uv

uv add django-soft-delete

poetry

poetry add django-soft-delete

Installing django-soft-delete

Before you install

Low install friction—a pure Python wheel with only django as a runtime dependency. Actively maintained with recent commits and no known vulnerabilities.

License in practice

MIT license permits commercial and private use with minimal restrictions, making this safe to adopt in most projects.

Quickstart

pip install django-soft-delete

from django.db import models

class Article(SoftDeleteModel):
    title = models.CharField(max_length=100)

# Then run: python manage.py makemigrations && python manage.py migrate
# Article.objects.create(title='Test')
# Article.objects.all()  # sees only alive objects
# Article.deleted_objects.all()  # sees only deleted objects

Requires django to be installed and a configured Django project with migrations support.

Verify before relying

  • Whether soft-delete cascading works correctly when parent and child models use different on_delete strategies.
  • Performance impact when querying large tables with many soft-deleted records.
  • Compatibility with Django admin's default delete action and whether it respects soft deletion.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — django
Maintenance actively maintained — 174 days since the last release
Last repo commit
First released
Downloads 134,999/month — #11,456 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_soft_delete-1.0.23-py3-none-any.whl

Environment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonTopic :: Software Development :: Libraries :: Python Modules

Tags

django soft deletelogical deletion djangosoft delete modelsrestore deleted recordsdeleted objects managermark as deleted djangosoft delete queryset
django-extensiondata-recoveryaudit-trail

More Python Modules packages

idna

Converts domain names between Unicode and…

permissive · top 100 on PyPI

setuptools

Setuptools is a Python build backend and…

permissive · top 100 on PyPI

PyYAML

PyYAML parses and emits YAML 1.1 data format,…

permissive · top 100 on PyPI

pydantic

Pydantic validates Python data structures…

permissive · top 100 on PyPI

annotated-types

Provides reusable metadata objects for use with…

permissive · top 100 on PyPI

typing-inspection

Provides runtime tools to inspect and…

permissive · top 100 on PyPI

django-safedelete

Provides soft-delete functionality for Django…

permissive · top 5,000 on PyPI

sqlalchemy-easy-softdelete

Adds soft-deletion support to SQLAlchemy models…

permissive · top 15,000 on PyPI

django-ordered-model

Adds ordering and reordering capabilities to…

permissive · top 15,000 on PyPI

django-add-default-value

Provides a Django migration operation to set…

permissive · top 15,000 on PyPI

django-deprecate-fields

Provides a decorator to mark Django model…

permissive · top 5,000 on PyPI

django-model-utils

Provides reusable model mixins and field…

permissive · top 5,000 on PyPI

django-cleanup

Automatically deletes old files when Django…

permissive · top 15,000 on PyPI

django-reverse-admin

Adds reverse inline support to Django admin for…

permissive · top 15,000 on PyPI

django-cacheops

Automatic and manual ORM query caching for…

permissive · top 5,000 on PyPI

django-pg-returning

Extends Django's ORM to capture and return rows…

permissive · top 15,000 on PyPI