Fix ordinal filter in template (#18878)
parent
c69fe43e75
commit
558504c686
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue