📜  pip install softdelet - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:18:35.415000             🧑  作者: Mango

Introducing SoftDelete - A Convenient Soft Deletion Package for Python

What is SoftDelete?

SoftDelete is a Python package designed to simplify the process of enabling soft deletion for your Python models. Soft deletion allows you to delete records without actually deleting them from the database - giving you the ability to recover them later if necessary.

How to Install

You can install SoftDelete using pip:

pip install softdelete
How to Use

Using SoftDelete is easy - just import the SoftDeleteModel class and inherit from it in your models:

from softdelete.models import SoftDeleteModel

class MyModel(SoftDeleteModel):
    # Your fields and methods here

Once SoftDelete is set up on your model, you can soft-delete records using the delete() method instead of objects.delete(). Soft-deleted records are ignored by the objects.all() and objects.filter() methods, but can be retrieved using the objects.deleted() method.

Features
  • Soft deletion made easy
  • Works seamlessly with Django models
  • No extra dependencies
Conclusion

SoftDelete is a convenient package for enabling soft deletion in your Python models. Give it a try and simplify your soft delete process today!