# Django字段错误：为User指定了未知字段(age)

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

## 根因

尝试查询或过滤模型中不存在的字段。

## 版本兼容性

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

## 解决方案

1. **Check model definition for correct field names** (95% 成功率)
   ```
   In models.py, ensure the field is defined: age = models.IntegerField()
   ```
2. **Use model's meta to list fields** (90% 成功率)
   ```
   User._meta.get_fields() to see available fields.
   ```

## 无效尝试

- **Assuming the field exists in the database** — Field must be defined in the model class. (90% 失败率)
- **Using incorrect field name spelling** — Even minor typos cause this error. (80% 失败率)
