Skip to main content

Blocks dangerous Django ORM QuerySet.delete() calls in production.

Project description

django-delete-guard (DeleteGuard)

Blocks dangerous Django ORM deletes in production — before they happen.

Backups and alerts are too late.
This stops risky QuerySet.delete() calls at execution time, unless the developer explicitly opts in.


Why this exists

If you’ve ever:

  • wiped production with a bad .delete()
  • underestimated cascade deletes
  • run a “quick cleanup” script in prod
  • trusted migrations too much

…this is for you.

Most catastrophic data loss is valid code with invalid intent.
Django makes bulk deletes deceptively easy. This guard makes them explicit.


What it does (V1)

In production only (APP_ENV=production|prod), it blocks:

  • Unfiltered deletes
    Model.objects.all().delete()

  • Bulk deletes over 100 rows

Unless you explicitly override with intent.

Everything else works normally.


Install (60 seconds)

pip install django-delete-guard

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_delete_guard-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

django_delete_guard-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file django_delete_guard-0.1.1.tar.gz.

File metadata

  • Download URL: django_delete_guard-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for django_delete_guard-0.1.1.tar.gz
Algorithm Hash digest
SHA256 66644e62d7dcaff2a27681c9a7bfacc3f5b7ea8e537a678aab6f4dde28084359
MD5 5abbc564441fd1e8369d5858d1654347
BLAKE2b-256 3a78dd724ba8f72a566e12b84d226168da7e4726ab9a4811e6025addda921007

See more details on using hashes here.

File details

Details for the file django_delete_guard-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_delete_guard-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ff6c7d9509128d9f986eae4af5a4b47d63999761c496b3bf734abc7aafd027f
MD5 ea42e4cdb52eefdeb5809d372a8ed1d1
BLAKE2b-256 e4d52a517fd08b150f401361241b8cd3b85266dd0b22d2043ecdf8ffc502a86b

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