@register.filter
def max_value(object_list, field):
 value_list = [getattr(o, field, None) for o in object_list]
 return max(value_list)

@ register . filter def max_value ( object_list , field ) : value_list = [ getattr ( o , field , None ) for o in object_list ] return max ( value_list )
returns the max value given an object_list and a field .