简体   繁体   English

django-1.3登录表单+ context_processor

[英]django-1.3 login form +context_processor

Django-1.3 I need to render a login form on every page. Django-1.3我需要在每个页面上呈现一个登录表单。 I'm confused, always used the "generic view 'django.contrib.views.auth.login' straight into my urls.py. 我很困惑,总是直接在urls.py中使用“通用视图'django.contrib.views.auth.login”。

Does anyone have a solution? 有没有人有办法解决吗?

Thanks in advance :) 提前致谢 :)

There are a couple of ways you could solve this... 有两种方法可以解决此问题...

One is a template tag that sits in a layout that all of your other pages inherit which adds the form. 一个是模板标记,它位于您所有其他页面都继承的布局中,从而添加了表单。

Another is a context processor that adds the form to the context which would be available on every page. 另一个是上下文处理器,它将表单添加到上下文中,该表单可在每个页面上使用。

Hope that helps you out. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM