pythondjangodjango-templatespinax

How can I get this Django template to render?


In Why is Django blocktrans working one place and not another?, I asked a similar question and accepted an answer after a "use i18n" response that resolved the behavior in question. Here, I am getting a TemplateSyntaxError in Pinax 0.9a1's template for seeing what a given user's followers are:

{% 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 %}

The error is:

TemplateSyntaxError at /tweets/followers/ABC/
Caught KeyError while rendering: u'other_user_display'

If I'm reading the template correctly, the next-to-last (non-whitespace) line in the template defines other_user_display. user_display() is defined in lib/python2.7/site-packages/pinax/apps/account/utils.py.

What else needs to be done to make user_display other_user / other_user_display available?


Solution

  • Define your {{ other_user_display }} variable within the blocktrans tag. Second example from https://docs.djangoproject.com/en/1.9/topics/i18n/translation/#blocktrans-template-tag