Use a materialized Extension.latest_version field instead of a dynamic property #152
@ -76,7 +76,9 @@ class SearchView(ListedExtensionsView):
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
if self.kwargs.get('tag_slug'):
|
||||
queryset = queryset.filter(versions__tags__slug=self.kwargs['tag_slug']).distinct()
|
||||
queryset = queryset.filter(
|
||||
latest_version__tags__slug=self.kwargs['tag_slug']
|
||||
).distinct()
|
||||
if self.kwargs.get('team_slug'):
|
||||
queryset = queryset.filter(team__slug=self.kwargs['team_slug'])
|
||||
if self.kwargs.get('user_id'):
|
||||
@ -94,7 +96,7 @@ class SearchView(ListedExtensionsView):
|
||||
Q(slug__icontains=token)
|
||||
| Q(name__icontains=token)
|
||||
| Q(description__icontains=token)
|
||||
| Q(versions__tags__name__icontains=token)
|
||||
| Q(latest_version__tags__name__icontains=token)
|
||||
)
|
||||
queryset = queryset.filter(search_query).distinct()
|
||||
return queryset.prefetch_related(
|
||||
|
Loading…
Reference in New Issue
Block a user