1
0
Fork 0

Fix users searchfield not working

This commit is contained in:
Dariusz Niemczyk 2023-08-04 17:26:25 +02:00
parent 875e385f68
commit 4fc3629dcd
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin):
inlines = [ItemImageInline] inlines = [ItemImageInline]
save_on_top = True save_on_top = True
autocomplete_fields = ["parent", "owner", "taken_by"] autocomplete_fields = ["parent", "owner", "taken_by"]
search_fields = ["name", "owner", "taken_by"] search_fields = ["name", "owner__name", "taken_by__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)
@ -106,6 +106,11 @@ class StaffProxyModelAdmin(UserAdmin):
def has_add_permission(self, request, obj=None): def has_add_permission(self, request, obj=None):
return request.user.is_superuser return request.user.is_superuser
def __has_view_permission(self, request, obj=None):
return True
has_view_permission = __has_view_permission
has_change_permission = has_add_permission has_change_permission = has_add_permission
has_delete_permission = has_add_permission has_delete_permission = has_add_permission
has_module_permission = has_add_permission has_module_permission = has_add_permission