diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2010-10-31 02:34:01 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2010-10-31 02:34:01 +0000 |
| commit | 429473a5229e18980541458ff85d148163dd8a07 (patch) | |
| tree | 5f645d8a3d6137e024503f33211788d6a7865d00 | |
| parent | fa8f0cb2d841d8187de9d3723bd9e1104db1ace1 (diff) | |
Fixed #13503 -- Corrected misleading custom permission example in the docs.
Thanks Daniel Moisset for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | docs/topics/auth.txt | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 1ea15f2fd1..4093d9f583 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -1197,19 +1197,23 @@ Custom permissions To create custom permissions for a given model object, use the ``permissions`` :ref:`model Meta attribute <meta-options>`. -This example model creates three custom permissions:: +This example Task model creates three custom permissions, i.e., actions users +can or cannot do with Task instances, specific to your appication:: - class USCitizen(models.Model): - # ... + class Task(models.Model): + ... class Meta: permissions = ( - ("can_drive", "Can drive"), - ("can_vote", "Can vote in elections"), - ("can_drink", "Can drink alcohol"), + ("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"), ) The only thing this does is create those extra permissions when you run -:djadmin:`manage.py syncdb <syncdb>`. +: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.) API reference ------------- |
