# 字段不存在错误：Book 没有名为 'published_year' 的字段

- **ID:** `python/django-query-param-missing`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

尝试按模型中不存在的字段进行过滤或排序。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Add the field to model: published_year = models.IntegerField() and run migrations.
   ```
2. **** (95% 成功率)
   ```
   Use correct existing field: published_date__year for filtering by year.
   ```

## 无效尝试

- **** — Adding a property named published_year to model doesn't make it queryable. (70% 失败率)
- **** — Using annotate with wrong name still raises FieldDoesNotExist. (50% 失败率)
