Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 429473a5229e18980541458ff85d148163dd8a07 1 parent fa8f0cb
Ramiro Morales authored October 31, 2010

Showing 1 changed file with 11 additions and 7 deletions. Show diff stats Hide diff stats

  1. 18  docs/topics/auth.txt
18  docs/topics/auth.txt
@@ -1197,19 +1197,23 @@ Custom permissions
1197 1197
 To create custom permissions for a given model object, use the ``permissions``
1198 1198
 :ref:`model Meta attribute <meta-options>`.
1199 1199
 
1200  
-This example model creates three custom permissions::
  1200
+This example Task model creates three custom permissions, i.e., actions users
  1201
+can or cannot do with Task instances, specific to your appication::
1201 1202
 
1202  
-    class USCitizen(models.Model):
1203  
-        # ...
  1203
+    class Task(models.Model):
  1204
+        ...
1204 1205
         class Meta:
1205 1206
             permissions = (
1206  
-                ("can_drive", "Can drive"),
1207  
-                ("can_vote", "Can vote in elections"),
1208  
-                ("can_drink", "Can drink alcohol"),
  1207
+                ("can_view", "Can see available tasks"),
  1208
+                ("can_change_status", "Can change the status of tasks"),
  1209
+                ("can_close", "Can remove a task by setting its status as closed"),
1209 1210
             )
1210 1211
 
1211 1212
 The only thing this does is create those extra permissions when you run
1212  
-:djadmin:`manage.py syncdb <syncdb>`.
  1213
+:djadmin:`manage.py syncdb <syncdb>`. Your code is in charge of checking the
  1214
+value of these permissions when an user is trying to access the functionality
  1215
+provided by the application (viewing tasks, changing the status of tasks,
  1216
+closing tasks.)
1213 1217
 
1214 1218
 API reference
1215 1219
 -------------

0 notes on commit 429473a

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