rafalp/Misago

Replace thread queryset plugin hooks used by thread detail view and private thread detail views

已关闭

#2,078 创建于 2026年5月17日

 (0 条评论) (0 个反应) (0 位负责人)Python (553 个派生)batch import
area: backendfeature: extensionsfeature: thread pagehelp wanted

仓库指标

星标
 (2,774 个星标)
PR 合并指标
 (平均合并 2天 6小时) (30 天内合并 37 个 PR)

描述

Those functions no longer exist on thread detail views:

  • get_thread_queryset
  • get_private_thread_queryset

Instead, we should implement get_thread_detail_view_select_related and get_private_thread_detail_view_select_related hooks that will take HttpRequest as only argument and return list[str].

DetailView should be updated to implement get_thread_select_related method:

def get_thread_select_related(self, request: HttpRequest) -> list[str]:
    return ["category"]

In ThreadDetailView:

def get_thread_select_related(self, request: HttpRequest) -> list[str]:
    return get_thread_detail_view_select_related_hook(super().get_thread_select_related, request)

In PrivateThreadDetailView:

def get_thread_select_related(self, request: HttpRequest) -> list[str]:
    return get_private_thread_detail_view_select_related_hook(super().get_thread_select_related, request)

get_thread calls in those detail views should be updated to self.get_thread(..., select_Related=self.get_thread_select_related(request))

贡献者指南