Skip to content

Commit 9efc624

Browse files
committed
refactor: use enums for status filters in suggestion list urls
1 parent 8f4f5d7 commit 9efc624

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/webview/suggestions/urls.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from django.urls import path
22

3+
from shared.models.linkage import (
4+
CVEDerivationClusterProposal,
5+
)
6+
37
from .views.detail import SuggestionDetailByCveView, SuggestionDetailView
48
from .views.lists import (
59
SuggestionListView,
@@ -26,17 +30,23 @@
2630
# Lists
2731
path(
2832
"untriaged/",
29-
SuggestionListView.as_view(status_filter="pending"),
33+
SuggestionListView.as_view(
34+
status_filter=CVEDerivationClusterProposal.Status.PENDING
35+
),
3036
name="untriaged_suggestions",
3137
),
3238
path(
3339
"accepted/",
34-
SuggestionListView.as_view(status_filter="accepted"),
40+
SuggestionListView.as_view(
41+
status_filter=CVEDerivationClusterProposal.Status.ACCEPTED
42+
),
3543
name="accepted_suggestions",
3644
),
3745
path(
3846
"dismissed/",
39-
SuggestionListView.as_view(status_filter="rejected"),
47+
SuggestionListView.as_view(
48+
status_filter=CVEDerivationClusterProposal.Status.REJECTED
49+
),
4050
name="dismissed_suggestions",
4151
),
4252
path(

src/webview/suggestions/views/lists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SuggestionListView(ListView, ABC):
2020

2121
template_name = "suggestions/suggestion_list.html"
2222
paginate_by = 10
23-
status_filter = None
23+
status_filter: CVEDerivationClusterProposal.Status | None = None
2424
package_filter: str | None = None # To be defined in concrete classes
2525

2626
def get_queryset(self) -> QuerySet[CVEDerivationClusterProposal]:

0 commit comments

Comments
 (0)