python
data_error
ai_generated
true
django.core.exceptions.FieldDoesNotExist: Book has no field named 'published_year'
ID: python/django-query-param-missing
80%Fix Rate
84%Confidence
0Evidence
2025-12-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Attempting to filter or order by a field that doesn't exist on the model.
generic中文
尝试按模型中不存在的字段进行过滤或排序。
Workarounds
-
90% success
Add the field to model: published_year = models.IntegerField() and run migrations.
-
95% success
Use correct existing field: published_date__year for filtering by year.
Dead Ends
Common approaches that don't work:
-
70% fail
Adding a property named published_year to model doesn't make it queryable.
-
50% fail
Using annotate with wrong name still raises FieldDoesNotExist.