--- id: django-soft-delete version: "1.0.23" license: MIT license_treatment: permissive maintenance: active --- # django-soft-delete — Soft delete models, managers, queryset for Django License: permissive · Maintenance: active · Downloads: 135.0K/mo ## 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 above — 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 pip install django-soft-delete uv add django-soft-delete 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_current - Install friction: low - Maintenance: active - Downloads: 135.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django soft delete, logical deletion django, soft delete models, restore deleted records, deleted objects manager, mark as deleted django, soft delete queryset, django-extension, data-recovery, audit-trail [View on SkillFed](https://skillfed.io/packages/django-soft-delete) · [View on PyPI](https://pypi.org/project/django-soft-delete/)