Have you tried the django Humanize plugin ?
You can find there what you are looking for.
Edit
You are right, humanization filters do not do this job here. After digging around the built-in filters and django tags, I could not find anything that would solve your problem. Therefore, I think you need a special filter for this. Sort of...
from django import template
register = template.Library()
def my_format(value):
if value - int(value) != 0:
return value
return int(value)
register.filter('my_format',my_format)
my_format.is_safe = True
And in your django template you can do something like ...
{% load my_filters %}
<html>
<body>
{{x|my_format}}
<br/>
{{y|my_format}}
</body>
</html>
x y, 1.0 1.1 , :
1
1.1
, .