Skip to content

Commit

Permalink
Fix labels filtering on repositories page (#472)
Browse files Browse the repository at this point in the history
Co-authored-by: ivan neivan <69588756+sgmdlt@users.noreply.github.com>
  • Loading branch information
remortalite and sgmdlt authored Feb 3, 2025
1 parent d09a3f4 commit 4e502ed
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions contributors/views/repositories_views/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def get_queryset(self):
)
.prefetch_related(Prefetch("labels", queryset=Label.objects.only("name")))
)

filtered_labels = self.request.GET.get('labels')
if filtered_labels:
queryset = queryset.filter(
labels__name__lower__in=filtered_labels.split('.'))
return queryset

template_name = "contributors_sections/repositories/repositories_list.html"
Expand Down Expand Up @@ -75,7 +80,11 @@ def get_context_data(self, **kwargs):
.only("name")
)

context["all_labels"] = all_labels
context["labels"] = labels
filtered_labels = self.request.GET.get('labels')
if filtered_labels:
labels = labels.filter(name__lower__in=filtered_labels.split('.'))

context['all_labels'] = all_labels
context['labels'] = labels

return context

0 comments on commit 4e502ed

Please sign in to comment.