Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Ordering '/api/projects' with 'list_id' or 'list_name' doesn't work

未關閉
#318 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
python
領域
api, backend

研究方向

從 patchwork/api/project.py 中的 ProjectList 開始,檢查 /api/projects 使用的 ordering_fields。重新實作依 list_id 和 list_name 排序,然後驗證該端點在升冪和降冪請求下不再引發回報的 FieldError。

由索引模型根據 Issue 內容生成。

描述

api bug

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getpatchwork/patchwork 的其他 Issue

查看 getpatchwork/patchwork 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。