Skip to main content

A Django models extension to add soft deletion functionality

Project description

==================

Django Relative SoftDeletion

==================

Django Relative SoftDeletion is a custom made Django plugin which allows you to Soft Delete database values, which means while deleting any data, it will flag the data as deleted but will not remove the data completely from database. And at the time of fetching data from database, you will automatically get filtered result (excluding deleted values).

Another important implementation in this plugin is that it will filter out deleted values also while filtering on reverse relations. It means while using filter() or exclude() function on Foreign fields (reverse relation lookups also), it will not include the deleted data in the result. If you want to include deleted data in filteration process, use all_objects() function instead of objects().

Installing

Activate your environment and install the plugin using the command given below:

pip install django-relative-softdeletion

Usage

Import the SoftDeletionModel from django_soft_deletion.models and inherit in your Model classes:

For example,

from django_soft_deletion.models import SoftDeletionModel

class Employee(SoftDeletionModel):
	pass

Functions

Model.objects()...: Return result excluding deleted values

Model.all_objects()...: Return result including deleted values

delete(): Soft delete the item

hard_delete(): Permanent delete the item

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

django-relative-softdeletion-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_relative_softdeletion-0.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file django-relative-softdeletion-0.0.2.tar.gz.

File metadata

  • Download URL: django-relative-softdeletion-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.5

File hashes

Hashes for django-relative-softdeletion-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1909a440196a91a7b8f68b59fe67c26afde39852a4e4104d946db5ef3793e59c
MD5 f22959abcc23a08b4a6c4b7e70b5fee7
BLAKE2b-256 8f18629672ee1cda822b56b1c0dd25285aace6fa6e49032a00f23291cdb56d4b

See more details on using hashes here.

File details

Details for the file django_relative_softdeletion-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_relative_softdeletion-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.5

File hashes

Hashes for django_relative_softdeletion-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a2b26e7486c8bd9a40ddf1600b0708603c30e7ca6bdf10893e9e9f17ebfa2f41
MD5 3364f25476bad981d1894f5ec3a1cd88
BLAKE2b-256 b4f70c7621378fca06c79213b3ee1039ca7a7ae6084f6a225b1fd320dc427a01

See more details on using hashes here.

Supported by

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