Django - Correct way to pass arguments to CBV decorators?
问题 The docs feature nice options for applying decorators such as login_required to Class Based Views. However, I'm a little unclear about how to pass specific arguments along with the decorator, in this case I'd like to change the login_url of the decorator. Something like the following, only valid: @login_required(login_url="Accounts:account_login") @user_passes_test(profile_check) class AccountSelectView(TemplateView): template_name='select_account_type.html' 回答1: You should use @method