1
0
Fork 0

Fix parent autocompletes

This commit is contained in:
Dariusz Niemczyk 2023-08-04 18:02:08 +02:00
parent e1a22100c4
commit d942c99cb9
No known key found for this signature in database
2 changed files with 10 additions and 5 deletions

View File

@ -38,8 +38,15 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin):
form = ItemForm form = ItemForm
inlines = [ItemImageInline] inlines = [ItemImageInline]
save_on_top = True save_on_top = True
autocomplete_fields = ["parent", "owner", "taken_by", "categories"] autocomplete_fields = [
search_fields = ["name", "owner__name", "taken_by__name"] "parent",
"owner",
"taken_by",
"categories",
]
search_fields = [
"name",
]
def formfield_for_foreignkey(self, db_field, request, **kwargs): def formfield_for_foreignkey(self, db_field, request, **kwargs):
formfield = super().formfield_for_foreignkey(db_field, request, **kwargs) formfield = super().formfield_for_foreignkey(db_field, request, **kwargs)

View File

@ -51,9 +51,7 @@ class Category(models.Model):
class StaffManager(UserManager): class StaffManager(UserManager):
def get_queryset(self): pass
qs = super().get_queryset()
return qs
class StaffProxyModel(User): class StaffProxyModel(User):