@register.filter()
def nice_display(item):
    if hasattr(item, 'all'):  # RelatedManager: display a list
        return ', '.join(map(text_type, item.all()))
    return item
Display a comma-separated list of models for M2M fields
dataset/ETHPy150Open magopian/django-data-exports/data_exports/templatetags/getter_tags.py/nice_display