Fix users searchfield not working

Fix_link_to_HSWAW
Dariusz Niemczyk 2023-08-04 17:26:25 +02:00
rodzic 875e385f68
commit 4fc3629dcd
Nie znaleziono w bazie danych klucza dla tego podpisu
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin):
inlines = [ItemImageInline]
save_on_top = True
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):
formfield = super().formfield_for_foreignkey(db_field, request, **kwargs)
@ -106,6 +106,11 @@ class StaffProxyModelAdmin(UserAdmin):
def has_add_permission(self, request, obj=None):
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_delete_permission = has_add_permission
has_module_permission = has_add_permission