This hook wraps the standard function that Misago uses to get complete threads data for the category threads page.
This hook can be imported from misago.threads.hooks:
from misago.threads.hooks import get_category_threads_page_threads_hookdef custom_get_category_threads_page_threads_filter(
action: GetCategoryThreadsPageThreadsHookAction,
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.
A category instance.
A dict with kwargs this view was called with.
A dict with the template context.
def get_category_threads_page_threads_action(
request: HttpRequest, category: Category, kwargs: dict
) -> dict:
...Misago function used to get the complete threads data for the category threads page. Returns a dict that is included in the template context under the threads key.
The request object.
A 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.threads.hooks import get_category_threads_page_threads_hook
@get_category_threads_page_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