Skip to content

Commit

Permalink
Fixed #12642 - Add docs for has_[add|change|delete]_permission ModelA…
Browse files Browse the repository at this point in the history
…dmin methods. Thanks to MadeR for the report and for the wiki contributors from which I took language for this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15066 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
timgraham committed Dec 27, 2010
1 parent ee5fb7d commit ddfe700
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/ref/contrib/admin/index.txt
Expand Up @@ -921,6 +921,27 @@ templates used by the :class:`ModelAdmin` views:
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
Expand Down

0 comments on commit ddfe700

Please sign in to comment.