【发布时间】:2016-10-31 05:02:51
【问题描述】:
在Why is Django blocktrans working one place and not another? 中,我问了一个类似的问题,并在“使用 i18n”响应解决了相关问题后接受了答案。在这里,我在 Pinax 0.9a1 的模板中得到了一个 TemplateSyntaxError,用于查看给定用户的关注者是什么:
{% 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 可用?
【问题讨论】:
标签: python django django-templates pinax