Django

Code

Ticket #2629 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] permission_required for auth.decorators

Reported by: dummy@habmalnefrage.de Assigned to: adrian
Milestone: Component: Contrib apps
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The idea for this decorator came up when I looked the auth docs and saw complicated python code (for me:) like this: my_view = user_passes_test(lambda u: u.has_perm('polls.can_vote'), login_url='/login/')(my_view)

As this code is for documentation purpose, I could also could rewrite it shorten and more user politely like this: my_view = permission_required('polls.can_vote')(my_view)

Attachments

auth-decorator-permission-required.diff (0.6 kB) - added by dummy@habmalnefrage.de on 08/30/06 13:39:11.

Change History

08/30/06 13:39:11 changed by dummy@habmalnefrage.de

  • attachment auth-decorator-permission-required.diff added.

09/21/06 20:44:28 changed by mtredinnick

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

(In [3779]) Fixed #2629 -- Added a permission_required decorator to django.contrib.auth.decorator. Thanks, dummy@habmalnefrage.de.


Add/Change #2629 ([patch] permission_required for auth.decorators)




Change Properties
Action