views:

81

answers:

2

I'd like to display only the numbers that lie in the thousands position for a value i.e. 193000 will be displayed as 193 and so on. How do I achieve this, maybe at the template level?

+3  A: 

Divide by 1000?

Geo
must have had a pretty long day...this will work well thanks.
sounds good ... but maybe use integer division so the result is not a float (ie, 193, not 193.000)
pavium
@Stephen: It's not even Monday!
R. Bemrose
no problem :). glad to be of help.
Geo
@Geo: just wanted to tell you I've soreted out my problem@R. Bemrose: :)
Can the values can exceed 999,999? If so, after dividing by 1000 you'll want to apply modulus 1000.
Philip Kelley
+1  A: 

as long as 193000 is an int, you can just divide it by 1000:

x = 193000.1
y = int(x)/1000

there's no filter already in Django, but you could add one yourself: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags

Rob Fonseca-Ensor