Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#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)

9414.diff (1.7 KB ) - added by Tim Graham 15 years ago.
clarify has_perm arguments permissions

Download all attachments as: .zip

Change History (8)

comment:1 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by Jacob, 16 years ago

Owner: changed from nobody to Jacob
Status: newassigned

comment:3 by Jacob, 16 years ago

Resolution: fixed
Status: assignedclosed

(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.

comment:4 by anonymous, 15 years ago

Resolution: fixed
Status: closedreopened

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>"

by Tim Graham, 15 years ago

Attachment: 9414.diff added

clarify has_perm arguments permissions

comment:5 by Tim Graham, 15 years ago

Has patch: set
milestone: 1.1
Triage Stage: AcceptedReady for checkin
Version: 1.0SVN

comment:6 by Russell Keith-Magee, 15 years ago

Resolution: fixed
Status: reopenedclosed

(In [11547]) Fixed #9414 -- Clarified the documentation on the permission decorators. Thanks to timo for the patch.

comment:7 by Russell Keith-Magee, 15 years ago

(In [11569]) [1.1.X] Fixed #9414 -- Clarified the documentation on the permission decorators. Thanks to timo for the patch.

Merge of r11547 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top