From aa53655e6ebaa356e1fa0b87e5a5d85bac20e982 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Sat, 14 Nov 2020 05:36:40 +0000 Subject: [PATCH] Improved examples in ModelAdmin.list_display docs. --- docs/ref/contrib/admin/index.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index ad9558024b..341e828053 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -589,7 +589,7 @@ subclass:: birthday = models.DateField() def decade_born_in(self): - return self.birthday.strftime('%Y')[:3] + "0's" + return '%d’s' % (self.birthday.year // 10 * 10) decade_born_in.short_description = 'Birth decade' class PersonAdmin(admin.ModelAdmin): @@ -678,7 +678,7 @@ subclass:: birthday = models.DateField() def born_in_fifties(self): - return self.birthday.strftime('%Y')[:3] == '195' + return 1950 <= self.birthday.year < 1960 born_in_fifties.boolean = True class PersonAdmin(admin.ModelAdmin):