﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22798	pluralize filter should pluralize float/Decimal values between 1 and 2	Daniel Watkins	nobody	"The pluralize filter works as expected for floats/Decimals outside of the range 1-2:

{{{
>>> pluralize(0.9)
u's'
>>> pluralize(2.1)
u's'
}}}

However, when applied to a decimal number between 1 and 2, it (incorrectly) does not pluralize:

{{{
>>> pluralize(1.2)
u''
}}}

Not only is this incorrect from an English standpoint, it also contradicts pluralize's docstring: ""Returns a plural suffix if the value is not 1.""

The problem appears to be at [https://github.com/django/django/blob/master/django/template/defaultfilters.py#L937 line 937] where the given value is converted directly to an integer; this chops the decimal part of the number off, making it appear to be 1.

The specific use case for this is:

{{{
{{ widget_count|floatformat:""-2"" }} widget{{ widget_count|pluralize }}
}}}

This will produce ""0.5 widgets"", ""1 widget"", and ""2.1 widgets"" correctly, but ""1.2 widget"" incorrectly.


(This ticket is a descendant of #16723, but that ticket was about a broader issue that encompassed this, and so ended up being closed as invalid.)"	Bug	closed	Template system	1.6	Normal	fixed			Accepted	1	0	0	0	0	0
