Django

Code

Ticket #9414 (closed: fixed)

Opened 1 year ago

Last modified 6 months ago

Documentation on has_perm and the permission_required decorator is confusing

Reported by: wallenfe Assigned to: jacob
Milestone: Component: Documentation
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

9414.diff (1.7 kB) - added by timo on 09/12/09 19:33:56.
clarify has_perm arguments permissions

Change History

02/26/09 12:54:28 changed by jacob

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • milestone set to 1.1.

04/02/09 13:44:05 changed by jacob

  • owner changed from nobody to jacob.
  • status changed from new to assigned.

04/03/09 13:30:55 changed by jacob

  • status changed from assigned to closed.
  • resolution set to fixed.

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

08/31/09 00:21:07 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

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

09/12/09 19:33:56 changed by timo

  • attachment 9414.diff added.

clarify has_perm arguments permissions

09/12/09 19:34:41 changed by timo

  • has_patch set to 1.
  • stage changed from Accepted to Ready for checkin.
  • version changed from 1.0 to SVN.
  • milestone deleted.

09/12/09 20:13:40 changed by russellm

  • status changed from reopened to closed.
  • resolution set to fixed.

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

09/13/09 01:33:09 changed by russellm

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


Add/Change #9414 (Documentation on has_perm and the permission_required decorator is confusing)




Change Properties
Action