This hook wraps the standard function that Misago uses to get the complete thread data for the private thread list view.
This hook can be imported from misago.privatethreads.hooks:
from misago.privatethreads.hooks import get_private_thread_list_threads_hookdef custom_get_private_thread_list_threads_filter(
action: GetPrivateThreadListThreadsHookAction,
request: HttpRequest,
category: Category,
kwargs: dict,
) -> dict:
...A function implemented by a plugin that can be registered in this hook.
Next function registered in this hook, either a custom function or Misago's standard one.
See the action section for details.
The request object.
The private threads category instance.
A dict with kwargs this view was called with.
A dict with the template context.
def get_private_thread_list_threads_action(
request: HttpRequest, category: Category, kwargs: dict
) -> dict:
...Misago function used to get the complete thread data for the private thread list view. Returns a dict that is added to the template context under the threads key.
The request object.
The private threads category instance.
A dict with kwargs this view was called with.
A dict with the template context.
The code below implements a custom filter function makes view use a different threads list template instead of the default one.
from django.http import HttpRequest
from misago.categories.models import Category
from misago.privatethreads.hooks import get_private_thread_list_threads_hook
@get_private_thread_list_threads_hook.append_filter
def replace_threads_list_template(
action, request: HttpRequest, category: Category, kwargs: dict
) -> dict:
data = action(request, kwargs)
data["template_name"] = "plugin/threads_list.html"
return data