How to translate function names in the Django admin?

Viewed 2895

When using list_display as described under http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display you can not only display fields but custom callables as well:

def colored_name(self):
    return '<span style="color: #%s;">%s %s</span>' % (self.color_code, self.first_name, self.last_name)
colored_name.allow_tags = True

And then use it like this:

list_display = ('first_name', 'last_name', 'colored_name')

Since first_name and last_name are normal fields we can just translate them like that:

first_name = models.CharField(_('first name'))
last_name = models.CharField(_('last name'))

So the question is:

How can I translate the name of my function? Where do I put my _('colored name')?

2 Answers
Related