aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site
diff options
context:
space:
mode:
authorGravatar swfarnsworth <[email protected]>2021-08-03 10:36:11 -0400
committerGravatar swfarnsworth <[email protected]>2021-08-03 10:47:34 -0400
commitc81c29fcfb752d41599406a511c0f1d814438c83 (patch)
tree454ff683110c88d75596435bbc65c0d5e39fc756 /pydis_site
parentsplit up checkbox options in query params (diff)
Convert data structure for query.
Was list[str], is now dict[str, set[str]], organized by category.
Diffstat (limited to 'pydis_site')
-rw-r--r--pydis_site/apps/resources/views/resources.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views/resources.py
index 693eebaf..8ca08bd6 100644
--- a/pydis_site/apps/resources/views/resources.py
+++ b/pydis_site/apps/resources/views/resources.py
@@ -13,7 +13,16 @@ def format_checkbox_options(options: str) -> list[str]:
def resource_view(request: HttpRequest) -> HttpResponse:
"""View for resources index page."""
- checkbox_options = format_checkbox_options(request.GET.get("checkboxOptions"))
+ checkbox_options = {
+ a: set(format_checkbox_options(request.GET.get(b)))
+ for a, b in (
+ ('topics', 'topicOption'),
+ ('type', 'typeOption'),
+ ('payment_tiers', 'paymentOption'),
+ ('complexity', 'complexityOption'),
+ )
+ }
+
return render(
request,
template_name="resources/resources.html",