Changeset 581
- Timestamp:
- 08/31/05 11:45:10 (3 years ago)
- Files:
-
- django/trunk/django/core/defaultfilters.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/defaultfilters.py
r538 r581 24 24 def floatformat(text, _): 25 25 """ 26 Displays a floating point number as 34.2 (with one decimal place s) - but26 Displays a floating point number as 34.2 (with one decimal place) - but 27 27 only if there's a point to be displayed 28 28 """ 29 from math import modf 29 30 if not text: 30 31 return '' 31 if text - int(text)< 0.1:32 return int(text)33 return "%.1f" % text32 if modf(float(text))[0] < 0.1: 33 return text 34 return "%.1f" % float(text) 34 35 35 36 def linenumbers(value, _):
