# django.db.models.deletion.ProtectedError: Cannot delete some instances of model 'Author' because they are referenced through protected foreign keys: 'Book.author'

- **ID:** `python/django-foreign-key-delete-protection`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Deleting a parent object that has child objects with on_delete=PROTECT.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Delete child objects first: Book.objects.filter(author=author).delete() then author.delete()
   ```
2. **** (80% success)
   ```
   Change on_delete=models.CASCADE in model and run migrations to allow cascading delete.
   ```

## Dead Ends

- **** — Changing on_delete to CASCADE in model requires migration and may delete data unintentionally. (60% fail)
- **** — Using raw SQL DELETE ignores Django's protection and can cause orphaned records. (50% fail)
