def order_run_queryset(runs, field, asc=False):
    """
    Annotate the TestRun queryset by calling order_by on it.
    """
    orderable_fields = ('run_id', 'summary', 'manager__username',
        'default_tester__username', 'env_groups', 'build__product__name',
        'product_version', 'plan__name')
    if field in orderable_fields:
        order_by = field
        if not asc:
            order_by = '-%s' % order_by
        runs = runs.order_by(order_by)
    return runs
