mirror of
https://github.com/jazzband/django-authority.git
synced 2026-04-04 23:40:25 +00:00
50 lines
1.8 KiB
Text
50 lines
1.8 KiB
Text
.. _handling-admin:
|
|
|
|
===================================================
|
|
Handling permissions using Django's admin interface
|
|
===================================================
|
|
|
|
*to be written*
|
|
|
|
.. note:: Django admin actions are available in Django 1.1 or later.
|
|
|
|
Apply permissions using Django's admin actions
|
|
==============================================
|
|
|
|
This feature is limited to superusers and users with either the
|
|
"Can change permission" (``change_permission``) or the
|
|
"Can change foreign permission" (``change_foreign_permission``) `permission`_.
|
|
|
|
.. image:: .static/admin-action-permission.png
|
|
.. _permission: http://docs.djangoproject.com/en/dev/topics/auth/#permissions
|
|
|
|
Disable the admin action site-wide
|
|
----------------------------------
|
|
|
|
To disable the action site-wide, place this line somewhere in your code.
|
|
One of your app ``admin.py`` files might be a good place::
|
|
|
|
admin.site.disable_action('edit_permissions')
|
|
|
|
Further informations are available in Django's documentation:
|
|
`Disabling a site-wide action`_.
|
|
|
|
.. _Disabling a site-wide action: http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disabling-a-site-wide-action
|
|
|
|
Disable the admin action per ModelAdmin instance
|
|
------------------------------------------------
|
|
|
|
In case you want to disable the permission action per ModelAdmin, delete this
|
|
action within the ``get_actions`` method. Here is an example::
|
|
|
|
class EntryAdmin(admin.ModelAdmin):
|
|
|
|
def get_actions(self, request):
|
|
actions = super(EntryAdmin, self).get_actions(request)
|
|
del actions['edit_permissions']
|
|
return actions
|
|
|
|
Further informations are available in Django's documentation:
|
|
`Conditionally enabling or disabling actions`_.
|
|
|
|
.. _Conditionally enabling or disabling actions: http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#conditionally-enabling-or-disabling-actions
|