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
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
canonical/paas-charm#368 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
tech debt
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·