Django: Tweaking @login_required decorator

后端 未结 4 1311
长情又很酷
长情又很酷 2020-12-24 15:17

I want to begin a private Beta for my website. I have a splash page where a user can enter a code to then access the rest of the site. Currently, all the other site pages (

4条回答
  •  感动是毒
    2020-12-24 15:45

    I would recommend using a middleware instead. That will make it easier to drop once you move out of your private beta. There are a couple examples of login required middlewares on djangonsippets:

    http://djangosnippets.org/snippets/1220/
    http://djangosnippets.org/snippets/136/

    I would recommend taking one of those and tweaking it to include you beta code logic.

提交回复
热议问题