在Why is Django blocktrans working one place and not another?中,我提出了类似的问题,并在"use i18n“响应解决了相关行为后接受了回答。在这里,我在Pinax0.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。在lib/python2.7/site-packages/pinax/apps/account/utils.py中定义了user_display()。
要使user_display other_user / other_user_display可用,还需要做些什么?
https://stackoverflow.com/questions/38083483
复制相似问题