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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -