'Returns a list of datetime objects representing all available dates for
the given field_name, scoped to \'kind\'.'

def dates(self, field_name, kind, order='ASC'):

    assert (kind in ('month', 'year', 'day', 'week', 'hour', 'minute')), "'kind'    must    be    one    of    'year',    'month',    'day',    'week',    'hour'    and    'minute'."
    assert (order in ('ASC', 'DESC')), "'order'    must    be    either    'ASC'    or    'DESC'."
    search = self._build_search()
    search.facet.reset()
    search.facet.add_date_facet(name=field_name.replace('__', '.'), field=field_name, interval=kind)
    search.size = 0
    connection = self.model._meta.dj_connection
    resulset = connection.connection.search(search, indices=connection.database, doc_types=self.type)
    resulset.fix_facets()
    entries = []
    for val in resulset.facets.get(field_name.replace('__', '.')).get('entries', []):
        if ('time' in val):
            entries.append(val['time'])
    if (order == 'ASC'):
        return sorted(entries)
    return sorted(entries, reverse=True)
