#9414 closed (fixed)
Documentation on has_perm and the permission_required decorator is confusing
Reported by: | wallenfe | Owned by: | Jacob |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation on using has_perm and permission_required is confusing in that it does not define how the permission string that is passed to those functions is defined.
The documentation should mention that the string is:
ApplicationName.PermissionName.
Since Permissions are defined on models, my first inclination was to try: ModelName.PermissionName
This is the documentation page I am referring to:
http://docs.djangoproject.com/en/dev/topics/auth/#topics-auth
And an example of the permission string being used, but without an explanation.
"
def my_view(request):
if not (request.user.is_authenticated() and request.user.has_perm('polls.can_vote')):
"
Attachments (1)
Change History (8)
comment:1 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 by , 15 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The documentation is still wrong: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.has_perm
It says "<application name>.<lowercased model name>"
repeatedly (at least twice) in the documentation, when in fact it should be "<application name>.<lowercased permission codename>"
comment:5 by , 15 years ago
Has patch: | set |
---|---|
milestone: | 1.1 |
Triage Stage: | Accepted → Ready for checkin |
Version: | 1.0 → SVN |
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
(In [10371]) Fixed a whole bunch of small docs typos, errors, and ommissions.
Fixes #8358, #8396, #8724, #9043, #9128, #9247, #9267, #9267, #9375, #9409, #9414, #9416, #9446, #9454, #9464, #9503, #9518, #9533, #9657, #9658, #9683, #9733, #9771, #9835, #9836, #9837, #9897, #9906, #9912, #9945, #9986, #9992, #10055, #10084, #10091, #10145, #10245, #10257, #10309, #10358, #10359, #10424, #10426, #10508, #10531, #10551, #10635, #10637, #10656, #10658, #10690, #10699, #19528.
Thanks to all the respective authors of those tickets.