Ticket #361: filter_math.patch
File filter_math.patch, 1.3 KB (added by , 16 years ago) |
---|
-
template/defaultfilters.py
593 593 return int(value) + int(arg) 594 594 add.is_safe = False 595 595 596 def mult(value, arg): 597 "Multiplies the arg and the value" 598 return int(value) * int(arg) 599 mult.is_safe = False 600 601 def sub(value, arg): 602 "Subtracts the arg from the value" 603 return int(value) - int(arg) 604 sub.is_safe = False 605 606 def div(value, arg): 607 "Divides the value by the arg" 608 return int(value) / int(arg) 609 div.is_safe = False 610 596 611 def get_digit(value, arg): 597 612 """ 598 613 Given a whole number, returns the requested digit of it, where 1 is the … … 804 819 register.filter(default_if_none) 805 820 register.filter(dictsort) 806 821 register.filter(dictsortreversed) 822 register.filter(div) 807 823 register.filter(divisibleby) 808 824 register.filter(escape) 809 825 register.filter(escapejs) … … 824 840 register.filter(ljust) 825 841 register.filter(lower) 826 842 register.filter(make_list) 843 register.filter(mult) 827 844 register.filter(phone2numeric) 828 845 register.filter(pluralize) 829 846 register.filter(pprint) … … 835 852 register.filter(slugify) 836 853 register.filter(stringformat) 837 854 register.filter(striptags) 855 register.filter(sub) 838 856 register.filter(time) 839 857 register.filter(timesince) 840 858 register.filter(timeuntil)