Skip to content

Commit 56a1ede

Browse files
author
I
committed
fix: show all enabled Benchmark Types (ASVS, etc.) in dropdown on product view
Previously, only one Benchmark Type (e.g., ASVS) appeared in the product view dropdown, even if more were in the database. Now, the view passes all enabled Benchmark Types to the template, so the dropdown correctly lists every available type. No template changes were needed; just the view logic was updated.
1 parent a81cf78 commit 56a1ede

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

dojo/product/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
System_Settings,
9191
Test,
9292
Test_Type,
93+
Benchmark_Type,
9394
)
9495
from dojo.product.queries import (
9596
get_authorized_global_groups_for_product,
@@ -146,13 +147,17 @@ def product(request):
146147
# perform annotation/prefetching by replacing the queryset in the page with an annotated/prefetched queryset.
147148
prod_list.object_list = prefetch_for_product(prod_list.object_list)
148149

150+
# Get benchmark types for the template
151+
benchmark_type = Benchmark_Type.objects.filter(enabled=True).order_by("name")
152+
149153
add_breadcrumb(title=_("Product List"), top_level=not len(request.GET), request=request)
150154

151155
return render(request, "dojo/product.html", {
152156
"prod_list": prod_list,
153157
"prod_filter": prod_filter,
154158
"name_words": sorted(set(name_words)),
155159
"enable_table_filtering": get_system_setting("enable_ui_table_based_searching"),
160+
"benchmark_type": benchmark_type,
156161
"user": request.user})
157162

158163

@@ -294,6 +299,7 @@ def view_product(request, pid):
294299
"system_settings": system_settings,
295300
"benchmarks_percents": benchAndPercent,
296301
"benchmarks": benchmarks,
302+
"benchmark_type": product_tab.benchmark_type,
297303
"product_members": product_members,
298304
"global_product_members": global_product_members,
299305
"product_type_members": product_type_members,

0 commit comments

Comments
 (0)