Skip to main content

this application is for handling delete operations in the system

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dj_soft_delete-1.0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

dj_soft_delete-1.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file dj_soft_delete-1.0.1.tar.gz.

File metadata

  • Download URL: dj_soft_delete-1.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for dj_soft_delete-1.0.1.tar.gz
Algorithm Hash digest
SHA256 01cba045fc385de95dd3a09f77cfc7a64f1b8ec035d9f82642e7f853f32c8b00
MD5 7b7a3371d0229c509a0986466c8e51f4
BLAKE2b-256 6dff1d0919f097f30192e650d104706aad729da3a747b0ab2c26a4157317ad79

See more details on using hashes here.

File details

Details for the file dj_soft_delete-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dj_soft_delete-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de8b954b157b89f4cd82343eab8af74ccc1bbadca65323f42f9389e015ea689f
MD5 c40e129d04e3bd2e022740258b07a058
BLAKE2b-256 3a37be7e0508cf1ce0ff21607840527c591e5eb4985eeeb3c431006ac600641d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page