from django.template import Library def gt(value, arg): "Returns a boolean of whether the value is greater than the argument" return value > int(arg) def lt(value, arg): "Returns a boolean of whether the value is less than the argument" return value < int(arg) def gte(value, arg): "Returns a boolean of whether the value is greater than or equal to the argument" return value >= int(arg) def lte(value, arg): "Returns a boolean of whether the value is less than or equal to the argument" return value <= int(arg) def length_gt(value, arg): "Returns a boolean of whether the value's length is greater than the argument" return len(value) > int(arg) def length_lt(value, arg): "Returns a boolean of whether the value's length is less than the argument" return len(value) < int(arg) def length_gte(value, arg): "Returns a boolean of whether the value's length is greater than or equal to the argument" return len(value) >= int(arg) def length_lte(value, arg): "Returns a boolean of whether the value's length is less than or equal to the argument" return len(value) <= int(arg) register = Library() register.filter('gt', gt) register.filter('lt', lt) register.filter('gte', gte) register.filter('lte', lte) register.filter('length_gt', length_gt) register.filter('length_lt', length_lt) register.filter('length_gte', length_gte) register.filter('length_lte', length_lte)
Last modified
18 years ago
Last modified on Oct 23, 2006, 2:16:50 AM
Note:
See TracWiki
for help on using the wiki.