python - Managing django admin filters according to permissions -
i creating python django
project , while in admin want make function this:
the user opens thecustomer
window show list of customers
if user has permission
location filter visible if there no permission
filter not visible.
is possible , if yes how?
you can override get_list_filter method of modeladmin
, check permissions in there.
example:
myadmin(admin.modeladmin): def get_list_filter(self, request): if request.user.has_perm('some_perm'): return ['filter_1', 'filter_2', ......] else: return []
Comments
Post a Comment