且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Django-allauth注册,登录和社交连接到一个页面

更新时间:2023-12-02 11:36:04

处理您的索引URL并呈现您的index.html模板的视图必须具有登录表单,因为您必须将其设置为FormView后代,并将类属性设置为LoginForm(allauth的登录表单)。否则,您无法将{{form.as_p}}呈现到模板中(因为您的上下文中没有表单)。

The view that handles your 'index' url and renders your index.html template has to have a login form, for that you have to make it a FormView descendant, and set the class attribute to LoginForm (allauth's login form). Otherwise, you can't render {{form.as_p}} to the template (because there is no form in your context).