From c0335a30bc116b6e94d836b22f35b08b5519bc53 Mon Sep 17 00:00:00 2001 From: Timo Graham Date: Mon, 27 Dec 2010 13:41:57 +0000 Subject: [PATCH] [1.2.X] Fixed #12642 - Add docs for has_[add|change|delete]_permission ModelAdmin methods. Thanks to MadeR for the report and for the wiki contributors from which I took language for this patch. Backport of r15066 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15067 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/contrib/admin/index.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index b99cfdc78c..f2bbdb2c76 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -887,6 +887,27 @@ to multiple owners -- a many to many relationship -- you could filter the kwargs["queryset"] = Car.objects.filter(owner=request.user) return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs) +.. method:: ModelAdmin.has_add_permission(self, request) + + Should return ``True`` if adding an object is permitted, ``False`` + otherwise. + +.. method:: ModelAdmin.has_change_permission(self, request, obj=None) + + Should return ``True`` if editing obj is permitted, ``False`` otherwise. + If obj is ``None``, should return ``True`` or ``False`` to indicate whether + editing of objects of this type is permitted in general (e.g., ``False`` + will be interpreted as meaning that the current user is not permitted to + edit any object of this type). + +.. method:: ModelAdmin.has_delete_permission(self, request, obj=None) + + Should return ``True`` if deleting obj is permitted, ``False`` otherwise. + If obj is ``None``, should return ``True`` or ``False`` to indicate whether + deleting objects of this type is permitted in general (e.g., ``False`` will + be interpreted as meaning that the current user is not permitted to delete + any object of this type). + .. method:: ModelAdmin.queryset(self, request) The ``queryset`` method on a ``ModelAdmin`` returns a