forked from wiktor/spejstore-new
Fix users searchfield not working
This commit is contained in:
parent
875e385f68
commit
4fc3629dcd
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue