From 920448539631b52dcee53bd32a880abbc9de18bd Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Wed, 13 Jan 2021 16:19:22 +0000 Subject: Fixed #16117 -- Added decorators for admin action and display functions. Refs #25134, #32099. --- docs/topics/i18n/translation.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'docs/topics') diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 7a7bf85ebc..1819359725 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -389,12 +389,14 @@ verbose names Django performs by looking at the model's class name:: verbose_name = _('my thing') verbose_name_plural = _('my things') -Model methods ``short_description`` attribute values -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Model methods ``description`` argument to the ``@display`` decorator +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For model methods, you can provide translations to Django and the admin site -with the ``short_description`` attribute:: +with the ``description`` argument to the :func:`~django.contrib.admin.display` +decorator:: + from django.contrib import admin from django.db import models from django.utils.translation import gettext_lazy as _ @@ -406,9 +408,9 @@ with the ``short_description`` attribute:: verbose_name=_('kind'), ) + @admin.display(description=_('Is it a mouse?')) def is_mouse(self): return self.kind.type == MOUSE_TYPE - is_mouse.short_description = _('Is it a mouse?') Working with lazy translation objects ------------------------------------- -- cgit v1.3