Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12642 - Add docs for has_[add|change|delete]_permission ModelA…

…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...
commit ddfe700563ebfa7464f05d373d25247c008dddf2 1 parent ee5fb7d
Tim Graham authored

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  docs/ref/contrib/admin/index.txt
21  docs/ref/contrib/admin/index.txt
@@ -921,6 +921,27 @@ templates used by the :class:`ModelAdmin` views:
921 921
                     kwargs["queryset"] = Car.objects.filter(owner=request.user)
922 922
                 return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
923 923
 
  924
+.. method:: ModelAdmin.has_add_permission(self, request)
  925
+
  926
+    Should return ``True`` if adding an object is permitted, ``False``
  927
+    otherwise.
  928
+
  929
+.. method:: ModelAdmin.has_change_permission(self, request, obj=None)
  930
+
  931
+    Should return ``True`` if editing obj is permitted, ``False`` otherwise.
  932
+    If obj is ``None``, should return ``True`` or ``False`` to indicate whether
  933
+    editing of objects of this type is permitted in general (e.g., ``False``
  934
+    will be interpreted as meaning that the current user is not permitted to
  935
+    edit any object of this type).
  936
+
  937
+.. method:: ModelAdmin.has_delete_permission(self, request, obj=None)
  938
+
  939
+    Should return ``True`` if deleting obj is permitted, ``False`` otherwise.
  940
+    If obj is ``None``, should return ``True`` or ``False`` to indicate whether
  941
+    deleting objects of this type is permitted in general (e.g., ``False`` will
  942
+    be interpreted as meaning that the current user is not permitted to delete
  943
+    any object of this type).
  944
+
924 945
 .. method:: ModelAdmin.queryset(self, request)
925 946
 
926 947
     The ``queryset`` method on a ``ModelAdmin`` returns a

0 notes on commit ddfe700

Please sign in to comment.
Something went wrong with that request. Please try again.