From d942c99cb9ee4ebe1dfb6817954da9ad7e15faea Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Fri, 4 Aug 2023 18:02:08 +0200 Subject: [PATCH] Fix parent autocompletes --- storage/admin.py | 11 +++++++++-- storage/models.py | 4 +--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/storage/admin.py b/storage/admin.py index 0dd6629..55aa82a 100644 --- a/storage/admin.py +++ b/storage/admin.py @@ -38,8 +38,15 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin): form = ItemForm inlines = [ItemImageInline] save_on_top = True - autocomplete_fields = ["parent", "owner", "taken_by", "categories"] - search_fields = ["name", "owner__name", "taken_by__name"] + autocomplete_fields = [ + "parent", + "owner", + "taken_by", + "categories", + ] + search_fields = [ + "name", + ] def formfield_for_foreignkey(self, db_field, request, **kwargs): formfield = super().formfield_for_foreignkey(db_field, request, **kwargs) diff --git a/storage/models.py b/storage/models.py index 4bdb449..af86ec6 100644 --- a/storage/models.py +++ b/storage/models.py @@ -51,9 +51,7 @@ class Category(models.Model): class StaffManager(UserManager): - def get_queryset(self): - qs = super().get_queryset() - return qs + pass class StaffProxyModel(User):