Author: ubernostrum
Date: 2011-09-10 22:48:39 -0700 (Sat, 10 Sep 2011)
New Revision: 16814
Modified:
django/branches/releases/1.3.X/docs/topics/auth.txt
Log:
[1.3.X] Fixed #16094: Added clear example of how to refer to custom
permissions. Backport of [16813] from trunk.
Modified: django/branches/releases/1.3.X/docs/topics/auth.txt
===================================================================
--- django/branches/releases/1.3.X/docs/topics/auth.txt 2011-09-11 05:47:48 UTC
(rev 16813)
+++ django/branches/releases/1.3.X/docs/topics/auth.txt 2011-09-11 05:48:39 UTC
(rev 16814)
@@ -1251,17 +1251,20 @@
...
class Meta:
permissions = (
- ("can_view", "Can see available tasks"),
- ("can_change_status", "Can change the status of tasks"),
- ("can_close", "Can remove a task by setting its status as
closed"),
+ ("view_task", "Can see available tasks"),
+ ("change_task_status", "Can change the status of tasks"),
+ ("close_task", "Can remove a task by setting its status as
closed"),
)
The only thing this does is create those extra permissions when you run
:djadmin:`manage.py syncdb <syncdb>`. Your code is in charge of checking the
value of these permissions when an user is trying to access the functionality
provided by the application (viewing tasks, changing the status of tasks,
-closing tasks.)
+closing tasks.) Continuing the above example, the following checks if a user
may
+view tasks:
+ user.has_perm('app.view_task')
+
API reference
-------------
--
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.