Skip to content

Commit

Permalink
improve code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Sep 23, 2024
1 parent 87ec69c commit bb97143
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions finder/admin/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ def fetch_inodes(self, request, folder_id):
'inodes': inodes,
})

def search_for_inodes(self, starting_folder, query, sorting=None):
def search_for_inodes(self, starting_folder, search_query, sorting=None):
if isinstance(starting_folder.descendants, QuerySet):
parent_ids = Subquery(starting_folder.descendants.values('id'))
else:
parent_ids = [descendant.id for descendant in starting_folder.descendants]
return self.get_inodes(
sorting=sorting,
parent_id__in=parent_ids,
name__icontains=query,
name__icontains=search_query,
)

def upload_files(self, request, folder_id):
Expand Down
4 changes: 4 additions & 0 deletions finder/models/inode.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def file_models(cls):


class InodeManagerMixin:
"""
Mixin class to be added to managers for models ineriting from `Inode`.
"""

def filter_inodes(self, **lookup):
from .folder import FolderModel

Expand Down

0 comments on commit bb97143

Please sign in to comment.