Author: jezdez
Date: 2009-12-22 08:37:24 -0600 (Tue, 22 Dec 2009)
New Revision: 11948

Modified:
   django/branches/releases/1.1.X/docs/topics/auth.txt
Log:
[1.1.X] Fixed #8145 - Documented the codenames of the default auth permissions

Modified: django/branches/releases/1.1.X/docs/topics/auth.txt
===================================================================
--- django/branches/releases/1.1.X/docs/topics/auth.txt 2009-12-22 14:37:16 UTC 
(rev 11947)
+++ django/branches/releases/1.1.X/docs/topics/auth.txt 2009-12-22 14:37:24 UTC 
(rev 11948)
@@ -212,8 +212,9 @@
     .. method:: models.User.has_perm(perm)
 
         Returns ``True`` if the user has the specified permission, where perm 
is
-        in the format ``"<app label>.<permission codename>"``.
-        If the user is inactive, this method will always return ``False``.
+        in the format ``"<app label>.<permission codename>"``. (see
+        `permissions`_ section below). If the user is inactive, this method 
will
+        always return ``False``.
 
     .. method:: models.User.has_perms(perm_list)
 
@@ -1091,6 +1092,8 @@
     def limited_object_detail(*args, **kwargs):
         return object_detail(*args, **kwargs)
 
+.. _permissions:
+
 Permissions
 ===========
 
@@ -1133,6 +1136,14 @@
 permissions for new models each time you run :djadmin:`manage.py syncdb
 <syncdb>`.
 
+Assuming you have an application with an
+:attr:`~django.db.models.Options.app_label` ``foo`` and a model named ``Bar``,
+to test for basic permissions you should use:
+
+    * add: ``user.has_perm('foo.add_bar')``
+    * change: ``user.has_perm('foo.change_bar')``
+    * delete: ``user.has_perm('foo.delete_bar')``
+
 .. _custom-permissions:
 
 Custom permissions

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to