# Django模板语法错误：无法解析剩余部分：'=' 来自 'user.age='

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

## 根因

模板语法不正确，通常由于等号位置错误或过滤器语法错误。

## 版本兼容性

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

## 解决方案

1. **Use correct template filter syntax** (95% 成功率)
   ```
   {{ user.age|default:'N/A' }}
   ```
2. **Remove equals sign** (90% 成功率)
   ```
   {{ user.age }}
   ```

## 无效尝试

- **Adding spaces around =** — Django template syntax is strict. (80% 失败率)
- **Using Python syntax in templates** — Templates use Django template language, not Python. (90% 失败率)
