views:

147

answers:

1

Maybe i'm missing something but i'm looking to add a float number, something like this:

{%floatnumber|add:3.4%}

Filter add round my result so I don't want to write my filter, but if is the only way, i'll copy add filter

Now i'm doing this:

def addf(value, arg):
    """Adds the arg to the value."""
    return float(value) + float(arg)
addf.is_safe = False
register.filter(addf)
+1  A: 

Right now it turns it into int. There is an open ticket and I even sent a patch, but it haven't been commited yet ;-) Here is the ticket.

gruszczy
i just added my own filter waiting that it chages i just use it in one template
sacabuche
Better use mine - it allows to add any two values, that can be added in python itself. More generic :-)
gruszczy
you are right i haven't see your link
sacabuche