How do I use the The login_required decorator in my URL?

前端 未结 4 1910
暗喜
暗喜 2021-02-18 19:22

I want to check that the user is authorized for certain URLs. I\'m using generic views.

The docs here say the login_required can be passed as an optional arguments but I

4条回答
  •  孤街浪徒
    2021-02-18 20:16

    Those docs are for generic views, which work slightly differently than custom views. Normally login_required is used to decorate a view; if you want to use it within a urlconf then you'll need to write a lambda to wrap the view.

提交回复
热议问题