@current_app.template_filter()
def max_key(value, key):
    values = [r.get(key, 0) if hasattr(r, 'get') else getattr(r, key, 0) for r in value]
    return max(values)
Returns the maximum value in a 'column' in a list of dictionaries or objects.
dataset/ETHPy150Open Robpol86/Flask-Large-Application-Example/pypi_portal/middleware.py/max_key