blob: 10eda13208717672db4fcc311f3b56c58999bf6b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import typing
from pathlib import Path
from django_distill import distill_path
from pydis_site.apps.resources import views
app_name = "resources"
def get_all_resources() -> typing.Iterator[dict[str, str]]:
"""Yield a dict of all resource categories."""
for category in Path("pydis_site", "apps", "resources", "resources").iterdir():
yield {"category": category.name}
urlpatterns = [
distill_path("", views.ResourcesView.as_view(), name="index"),
distill_path(
"<str:category>/",
views.ResourcesListView.as_view(),
name="resources",
distill_func=get_all_resources
),
]
|