Ordering '/api/projects' with 'list_id' or 'list_name' doesn't work
還沒有人認領這個 Issue。
評估
研究方向
從 patchwork/api/project.py 中的 ProjectList 開始,檢查 /api/projects 使用的 ordering_fields。重新實作依 list_id 和 list_name 排序,然後驗證該端點在升冪和降冪請求下不再引發回報的 FieldError。
由索引模型根據 Issue 內容生成。
描述
If you set the ordering filter to list_id ascending/descending or list_name ascending/descending in /api/projects, the following exception will be thrown:
FieldError at /api/projects/
Cannot resolve keyword 'link_name' into field. Choices are: bundle, delegationrule, id, linkname, listemail, listid, maintainer_project, name, patch, scm_url, send_notifications, series, subject_match, submission, use_tags, web_url, webscm_url
Suggested fix:
diff --git a/patchwork/api/project.py b/patchwork/api/project.py
index 3609f73..c249f54 100644
--- a/patchwork/api/project.py
+++ b/patchwork/api/project.py
@@ -83,7 +83,7 @@ class ProjectList(ProjectMixin, ListAPIView):
search_fields = ('link_name', 'list_id', 'list_email', 'web_url',
'scm_url', 'webscm_url')
- ordering_fields = ('id', 'name', 'link_name', 'list_id')
+ ordering_fields = ('id', 'name', 'linkname', 'listid')
ordering = 'id'
Does this fix look good enough? Should I send a patch?
- 主要語言
- Python
- 星號
- 317
- 分支
- 91
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getpatchwork/patchwork 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
getpatchwork/patchwork#668 ·
-
bug web-ui
難度 2/5 1-3 小時 新手友好度 74/100
getpatchwork/patchwork#546 · 2 則留言 ·
-
難度 3/5 1-2 天 新手友好度 52/100
getpatchwork/patchwork#664 ·
-
難度 4/5 3-5 天 新手友好度 48/100
getpatchwork/patchwork#663 ·
-
難度 3/5 1-2 天 新手友好度 45/100
getpatchwork/patchwork#645 ·
查看 getpatchwork/patchwork 的全部 Issue
相似的 Issue
-
bug confirmed issue
難度 2/5 1-3 小時 新手友好度 75/100
open-webui/open-webui#30750 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
-
good first issue
難度 1/5 1 小時以內 新手友好度 90/100