2012-11-27 27 views
0

我使用夹层构建我的网站。在模板中,我使用templatetag。当我传递给像“categorytofilter”这templatetag字,它的确定,但是当我试图通过unicode字符串:将unicode字符串传递给django模板中的templatetag导致错误

{% blog_recent_posts limit=6 category='Статьи' as recent_posts %} 

我看到的错误:

'ascii' codec can't encode characters in position 10-15: ordinal not in range(128) 

我怎样才能解决呢? TIA!

+0

这有帮助吗?我不确定具体是什么答案,但我想这个链接会有所帮助:https://docs.djangoproject.com/en/dev/ref/unicode/#templates – themanatuf

+0

它并没有帮助 – dizpers

回答

0

好像你是通过类ascii而不是unicode。

尝试

{% blog_recent_posts limit=6 category=u'Статьи' as recent_posts %} 

,如果你硬编码的类别,否则,请指定/传递到模板之前,在您看来投放。