# django.db.utils.IntegrityError: NOT NULL constraint failed: app_model.field

- **ID:** `python/django-model-save-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to save a model instance with a required field set to NULL.

## Version Compatibility

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

## Workarounds

1. **Provide a default value or set the field before save** (95% success)
   ```
   instance.field = value; instance.save()
   ```
2. **Allow NULL in model definition** (90% success)
   ```
   field = models.CharField(null=True, blank=True)
   ```

## Dead Ends

- **Setting field to empty string** — Empty string is not NULL but may still violate constraints if blank=False. (70% fail)
- **Ignoring the field** — Field must have a value. (90% fail)
