Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #13503 -- Corrected misleading custom permission exampl…

…e in the docs.

Thanks Daniel Moisset for the report.

Backport of [14403] from trunk

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14404 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 20c6f3f3d1a58960fcc141eb461f244ebdf266d0 1 parent 29ea1be
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
@@ -1181,19 +1181,23 @@ Custom permissions
1181 1181
 To create custom permissions for a given model object, use the ``permissions``
1182 1182
 :ref:`model Meta attribute <meta-options>`.
1183 1183
 
1184  
-This example model creates three custom permissions::
  1184
+This example Task model creates three custom permissions, i.e., actions users
  1185
+can or cannot do with Task instances, specific to your appication::
1185 1186
 
1186  
-    class USCitizen(models.Model):
1187  
-        # ...
  1187
+    class Task(models.Model):
  1188
+        ...
1188 1189
         class Meta:
1189 1190
             permissions = (
1190  
-                ("can_drive", "Can drive"),
1191  
-                ("can_vote", "Can vote in elections"),
1192  
-                ("can_drink", "Can drink alcohol"),
  1191
+                ("can_view", "Can see available tasks"),
  1192
+                ("can_change_status", "Can change the status of tasks"),
  1193
+                ("can_close", "Can remove a task by setting its status as closed"),
1193 1194
             )
1194 1195
 
1195 1196
 The only thing this does is create those extra permissions when you run
1196  
-:djadmin:`manage.py syncdb <syncdb>`.
  1197
+:djadmin:`manage.py syncdb <syncdb>`. Your code is in charge of checking the
  1198
+value of these permissions when an user is trying to access the functionality
  1199
+provided by the application (viewing tasks, changing the status of tasks,
  1200
+closing tasks.)
1197 1201
 
1198 1202
 API reference
1199 1203
 -------------

0 notes on commit 20c6f3f

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