def validate_ordering(self, cls, model):
        " Validate that ordering refers to existing fields or is random. "
        # ordering = None
        if cls.ordering:
            check_isseq(cls, 'ordering', cls.ordering)
            for idx, field in enumerate(cls.ordering):
                if field == '?' and len(cls.ordering) != 1:
                    raise ImproperlyConfigured("'%s.ordering' has the random "
                            "ordering marker '?', but contains other fields as "
                            "well. Please either remove '?' or the other fields."
                            % cls.__name__)
                if field == '?':
                    continue
                if field.startswith('-'):
                    field = field[1:]
                # Skip ordering in the format field1__field2 (FIXME: checking
                # this format would be nice, but it's a little fiddly).
                if '__' in field:
                    continue
                get_field(cls, model, 'ordering[%d]' % idx, field)
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/contrib/admin/validation.py/BaseValidator.validate_ordering/original