在Why is Django blocktrans working one place and not another?中,我問了一個類似的問題,並在「使用i18n」響應之後接受了解決相關問題的答案。在這裏,我得到的Pinax 0.9a1的模板TemplateSyntaxError對看到的給定用戶的追隨者:我如何獲得這個Django模板來呈現?
{% extends "microblogging/base.html" %}
{% load i18n %}
{% load avatar_tags %}
{% load account_tags %}
{% user_display other_user as other_user_display %}
{% block head_title %}{% blocktrans %}Followers of {{ other_user_display }}{% endblocktrans %}{% endblock %}
的錯誤是:
TemplateSyntaxError at /tweets/followers/ABC/
Caught KeyError while rendering: u'other_user_display'
如果我正確地讀模板,下模板中的最後(非空白)行定義了other_user_display
。 user_display()
在lib/python2.7/site-packages/pinax/apps/account/utils.py
中定義。
還有什麼需要做的,使user_display other_user
/other_user_display
可用?