# 字段错误：关联字段获得无效查找：icontains

- **ID:** `python/django-orm-related-field-error`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

对ForeignKey或ManyToManyField使用了不适用于关联字段的查找操作

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Article.objects.filter(author__name__icontains='john')
   ```
2. **** (90% 成功率)
   ```
   author = Author.objects.get(name__icontains='john'); articles = author.article_set.all()
   ```

## 无效尝试

- **** — 可能无法实现模糊搜索需求 (60% 失败率)
- **** — 查询不会返回结果 (90% 失败率)
