2013-04-08 44 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