'Validate that date_hierarchy refers to DateField or DateTimeField.'

def validate_date_hierarchy(self, cls, model):

    if cls.date_hierarchy:
        f = get_field(cls, model, 'date_hierarchy', cls.date_hierarchy)
        if (not isinstance(f, (models.DateField, models.DateTimeField))):
            raise ImproperlyConfigured(("'%s.date_hierarchy    is    neither    an    instance    of    DateField    nor    DateTimeField." % cls.__name__))
