def format_date(d, if_none=''):

    if d is None:
        return if_none

    now = timezone.now()
    fmt = (d.year == now.year) and '%d.%m' or '%d.%m.%Y'
    return d.strftime(fmt)
Format a date in a nice human readable way: Omit the year if it's the
dataset/ETHPy150Open feincms/feincms/feincms/module/extensions/datepublisher.py/format_date