Automated merge with ssh://hg@bitbucket.org/jezdez/django-authority/

--HG--
emptychangelog : true
This commit is contained in:
Martin Mahner 2009-07-17 11:30:14 +02:00
commit 51fdf7a069
4 changed files with 57 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -46,6 +46,17 @@ classes you defined::
urlpatterns += patterns('',
(r'^authority/', include('authority.urls')),
)
If you're using Django 1.1 and Django's admin interface, make sure you place
``authority.autodiscover()`` **before** ``admin.autodiscover()``::
authority.autodiscover()
admin.autodiscover()
This is because django-authority automatically adds a `site-wide action`_ to the
admin-site and it prevents errors if you later decide to remove this action.
See :ref:`handling-admin` how to remove the admin action.
That's all (for now).
.. _site-wide action: http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/

View file

@ -4,4 +4,48 @@
Handling permissions using Django's admin interface
===================================================
*to be written*
*to be written*
Apply permissions using Django's admin actions
==============================================
.. note:: Django admin actions are available in Django 1.1 or later.
.. image:: .static/admin-action-permission.png
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`_. If you encounter an error like::
Exception Type: KeyError at /admin/weblog/entry/
Exception Value: 'edit_permissions'
Make sure you placed ``authority.autodiscover()`` before ``admin.autodiscover()``.
See :ref:`configuration` for details.
.. _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

View file

@ -92,4 +92,4 @@ def edit_permissions(modeladmin, request, queryset):
edit_permissions.short_description = ugettext("Permissions for selected %(verbose_name_plural)s")
if actions:
site.add_action(edit_permissions)
site.add_action(edit_permissions, name='edit_permissions')