Added search bar to collection list

This commit is contained in:
Tris Forster 2023-03-04 17:06:28 +11:00
parent 1f0a336ed4
commit 0bd2596ebc

View File

@ -184,7 +184,11 @@ class LibraryWorkListView(WorkListView):
return True
def get_works(self):
collections = models.Collection.objects.filter(administrators=self.request.user)
collections = models.Collection.objects
if not self.request.user.is_superuser:
collections = collections.filter(administrators=self.request.user)
return Work.objects.filter(collection__in=collections).select_related('collection')
class CollectionWorkListView(WorkListView):