Skip to main content

Soft Delete

This package is used for implementing soft delete functionality in models, when used you can delete and restore deleted items unless it was hard deleted from the database.

Installation

pip install dj-soft-delete

Usage

you can use it by extending HasSoftDelete class in your model

    from django_soft_delete.models import HasSoftDelete
    
    
    class Item(HasSoftDelete):
        ...
  • retrieving items without deleted
    Item.objects.all()
  • retrieving items with deleted
    Item.with_trashed_objects.all()
  • **retrieving deleted items only
    Item.with_trashed_objects.deleted()
  • Soft deleting item
    # via objects manager
    Item.objects.filter(...).delete()

    # via model instance
    item = Item.objects.get(...)
    item.delete()
  • herd deleting items
    # via objects manager
    Item.objects.filter(...).hard_delete()

    # via model instance
    item = Item.objects.get(...)
    item.hard_delete()
  • Restore soft deleted items
    # via objects manager
    Item.with_trashed_objects.filter(...).restore()
    
    # via model instance
    item = Item.with_trashed_objects.get(...)
    item.restore()

Metadata

Release files for dj-soft-delete 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-soft-delete 1.0.1
File Size Uploaded
dj_soft_delete-1.0.1.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dj-soft-delete 1.0.1
File Interpreter ABI Platform
dj_soft_delete-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / dj_soft_delete-1.0.1.tar.gz

Download URL dj_soft_delete-1.0.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
01cba045fc385de95dd3a09f77cfc7a64f1b8ec035d9f82642e7f853f32c8b00
BLAKE2b-256 checksum
How to use checksums
6dff1d0919f097f30192e650d104706aad729da3a747b0ab2c26a4157317ad79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / dj_soft_delete-1.0.1-py3-none-any.whl

Download URL dj_soft_delete-1.0.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de8b954b157b89f4cd82343eab8af74ccc1bbadca65323f42f9389e015ea689f
BLAKE2b-256 checksum
How to use checksums
3a37be7e0508cf1ce0ff21607840527c591e5eb4985eeeb3c431006ac600641d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page