Fix ordinal filter in template (#18878)

pull/18879/head
Joakim Sørensen 2018-12-01 14:49:34 +01:00 committed by Fabian Affolter
parent c69fe43e75
commit 558504c686
1 changed files with 3 additions and 2 deletions

View File

@ -616,8 +616,9 @@ def base64_decode(value):
def ordinal(value):
"""Perform ordinal conversion."""
return str(value) + (list(['th', 'st', 'nd', 'rd'] + ['th'] * 6)
[(int(str(value)[-1])) % 10] if not
int(str(value)[-2:]) % 100 in range(11, 14) else 'th')
[(int(str(value)[-1])) % 10] if
int(str(value)[-2:]) % 100 not in range(11, 14)
else 'th')
@contextfilter