{"id":23072,"library":"django-softdelete","title":"django-softdelete","description":"Soft delete support for Django ORM, adding a 'deleted' field and custom manager to objects instead of hard-deleting them. Current version: 0.11.5. Release cadence is intermittent, with no recent updates.","status":"active","version":"0.11.5","language":"python","source_language":"en","source_url":"https://github.com/scoursen/django-softdelete","tags":["django","soft-delete","orm","undelete"],"install":[{"cmd":"pip install django-softdelete","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required: softdelete depends on Django ORM.","package":"Django","optional":false}],"imports":[{"note":"","symbol":"SoftDeleteManager","correct":"from softdelete.models import SoftDeleteManager"},{"note":"","symbol":"SoftDeleteObject","correct":"from softdelete.models import SoftDeleteObject"}],"quickstart":{"code":"from django.db import models\nfrom softdelete.models import SoftDeleteObject, SoftDeleteManager\n\nclass MyModel(SoftDeleteObject):\n    name = models.CharField(max_length=100)\n    objects = SoftDeleteManager()\n\n# Soft delete\nobj = MyModel.objects.create(name='test')\nobj.delete()  # Sets deleted_at timestamp, does not remove from DB\n\n# Restore\nobj.undelete()\n\n# Hard delete (bypass soft delete)\nobj.hard_delete()","lang":"python","description":"Basic usage: define model, soft delete, restore, hard delete."},"warnings":[{"fix":"Use MyModel.all_objects.filter() or MyModel.objects_all to query all records.","message":"By default, all model instances with a non-null deleted_at are excluded from queries using the default manager. Use objects_all (or the all_objects manager) to include soft-deleted instances.","severity":"gotcha","affected_versions":"<=0.11.5"},{"fix":"No fix needed; just be aware of the field type.","message":"The library uses a 'deleted_at' field. Ensure your database supports nullable datetime fields.","severity":"deprecated","affected_versions":"0.11.5"},{"fix":"Do not mix with Django's official soft delete features.","message":"The library does not support Django's built-in soft delete from Django 4.x or later. It is a separate implementation.","severity":"breaking","affected_versions":"0.11.5"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from softdelete.models import SoftDeleteObject","cause":"Incorrect import path; SoftDeleteObject is in softdelete.models, not softdelete directly.","error":"ImportError: cannot import name 'SoftDeleteObject' from 'softdelete'"},{"fix":"Ensure your model inherits from SoftDeleteObject and run makemigrations.","cause":"The model does not inherit from SoftDeleteObject or does not have the field.","error":"django.core.exceptions.FieldDoesNotExist: MyModel has no field named 'deleted_at'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}