# django.core.exceptions.MultipleObjectsReturned: get() returned more than one MyModel -- it returned 2!

- **ID:** `python/django-multiple-objects-returned`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

使用 get() 查询时，条件匹配了多个记录

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.2 | active | — | — |
| 4.0 | active | — | — |
| 5.0 | active | — | — |

## Workarounds

1. **使用 filter() 并获取第一个对象** (95% success)
   ```
   obj = MyModel.objects.filter(condition).first()
   ```
2. **添加唯一约束** (90% success)
   ```
   在模型字段中添加 unique=True 或使用 unique_together
   ```

## Dead Ends

- **忽略错误继续执行** — 异常会导致程序中断，无法忽略 (100% fail)
- **使用 filter() 代替 get()** — filter() 返回 QuerySet，后续代码可能期望单个对象 (50% fail)
