Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6699 closed (invalid)

contrib.auth decorators aren't using proper decorator syntax

Reported by: SmileyChris Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The related documentation ( is totally incorrect. Neither of the 2.3 or 2.4 decoration methods stated will work:

my_view = login_required(redirect_field_name='redirect_to')(my_view)

since the definition is:

def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME):

Other decorator methods in this are also wrong.

Change History (3)

comment:1 Changed 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

#6700, has a possible solution.

comment:2 Changed 8 years ago by mtredinnick

  • Resolution set to invalid
  • Status changed from new to closed

This is mistaken. Notice that login_required behaves differently based on whether function is passed in or not: one case returns a decorator (function=None), the other returns the decorated function.

comment:3 Changed 8 years ago by SmileyChris

Duh... I typed this up while answering an IRC problem without obviously looking too closely at the code. Sorry for the noise, Malcolm.

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