Skip to content

Commit

Permalink
Another attempt to fix server error bug
Browse files Browse the repository at this point in the history
cf #70835fa, prefetch_related to avoid later query attempts
  • Loading branch information
madprime committed Aug 12, 2020
1 parent 0d09901 commit 8a33c86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion private_sharing/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from common.mixins import NeverCacheMixin

from data_import.serializers import DataFile, DataFileSerializer
from data_import.models import DataFile
from data_import.serializers import DataFileSerializer
from data_import.utils import get_upload_path

from .api_authentication import CustomOAuth2Authentication, MasterTokenAuthentication
Expand Down Expand Up @@ -147,6 +148,9 @@ def get_queryset(self):
DataFile.objects.filter(user=self.obj.member.user)
.exclude(parent_project_data_file=None)
.exclude(parent_project_data_file__completed=False)
.select_related("parent_project_data_file")
.prefetch_related("parent_project_data_file__datatypes")
.prefetch_related("parent_project_data_file__direct_sharing_project")
)

if self.obj.all_sources_shared:
Expand Down

0 comments on commit 8a33c86

Please sign in to comment.