Skip to content

Commit

Permalink
Add the select_across QuerySet filter logic #1524
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Jan 13, 2025
1 parent a5d756d commit 2c0203c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scanpipe/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from collections import Counter
from contextlib import suppress
from pathlib import Path
from urllib.parse import urlparse

from django.apps import apps
from django.conf import settings
Expand All @@ -43,6 +44,7 @@
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import JsonResponse
from django.http import QueryDict
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.shortcuts import render
Expand Down Expand Up @@ -1233,7 +1235,14 @@ def export_xlsx_file_response(self):
return super().export_xlsx_file_response()

def get_projects_queryset(self, select_across=False):
# TODO: select_across
if select_across:
# TODO: We could store the previous URL in the Action form instead
if referrer_url := self.request.META.get("HTTP_REFERER", ""):
url_query = urlparse(referrer_url).query
project_filterset = ProjectFilterSet(data=QueryDict(url_query))
if project_filterset.is_valid():
return project_filterset.qs

return Project.objects.filter(pk__in=self.selected_project_ids)

def get_export_xlsx_queryset(self):
Expand Down

0 comments on commit 2c0203c

Please sign in to comment.