2013-04-08 41 views
0

我用我的网站模板宽下面的代码...Django的国际化资源管理器验证失败

{% for lang in languages %} 
         <li> 
          <form name="setLang{{ lang.1}}" action="/i18n/setlang/" method="POST">{% csrf_token %} 
           <input name="next" type="hidden" value="/" /> 
           <input type="hidden" name="language" value="{{ lang.0 }}" /> 
           <a class='{% if LANGUAGE_CODE == lang.0 %}selected{% endif %}' href="#" onclick="document.setLang{{ lang.1 }}.submit();return false;">{{ lang.0 }}</a> 
          </form> 
         </li> 
         {% endfor %} 

和urls.py我有

(r'^i18n/', include('django.conf.urls.i18n')) 

但在Internet Explorer中我得到csrf验证失败错误...是否有关于页面上有两种表单的问题?

+0

你把'{%csrf_token%}'放在两种形式中吗? – catherine 2013-04-09 03:17:23

回答

0

嗯,我不确定这是否能解决您的问题,但您应该在{{ lang.1之后放置一个空格,使其看起来像{{ lang.1 }}。至少应该尝试一下,看看语义是否会导致某个地方出现中断。

+0

nop that does not work ...:=( – ratata 2013-04-08 19:39:28

+0

End of the problem is not with the page has two forms。我已经用django文档的例子进行了测试,Internet Explorer 8仍然给出了错误403. – ratata 2013-04-08 20:02:38

+0

是的,你可以在问题中发布实际的错误消息吗?它可以帮助我或其他人解决问题 – fildred13 2013-04-08 20:04:02