diff options
| author | Jannis Leidel <jannis@leidel.info> | 2009-12-22 14:37:24 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2009-12-22 14:37:24 +0000 |
| commit | cf49f62be369996c845e7229d1801739473acc00 (patch) | |
| tree | de64b71b693dc0ae3f2f57160bde189411ec7155 /docs | |
| parent | 7d6213e0aa70340f4e3439abd43bc98427493bd8 (diff) | |
[1.1.X] Fixed #8145 - Documented the codenames of the default auth permissions
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11948 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth.txt | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 6a62be8c32..29d8f161be 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -212,8 +212,9 @@ Methods .. 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 @@ generic view itself. For example:: def limited_object_detail(*args, **kwargs): return object_detail(*args, **kwargs) +.. _permissions: + Permissions =========== @@ -1133,6 +1136,14 @@ models being installed at that time. Afterward, it will create default 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 |
