if isinstance(value, datetime.datetime):
    return format(value, '%Y-%m')
if isinstance(value, datetime.date):
    pass
Django - Need datetime fields that can handle only year, or year and month values