def validate_fieldsets(self, cls, model):
        " Validate that fieldsets is properly formatted and doesn't contain duplicates. "
        from django.contrib.admin.options import flatten_fieldsets
        if cls.fieldsets: # default value is None
            check_isseq(cls, 'fieldsets', cls.fieldsets)
            for idx, fieldset in enumerate(cls.fieldsets):
                check_isseq(cls, 'fieldsets[%d]' % idx, fieldset)
                if len(fieldset) != 2:
                    raise ImproperlyConfigured("'%s.fieldsets[%d]' does not "
                            "have exactly two elements." % (cls.__name__, idx))
                check_isdict(cls, 'fieldsets[%d][1]' % idx, fieldset[1])
                if 'fields' not in fieldset[1]:
                    raise ImproperlyConfigured("'fields' key is required in "
                            "%s.fieldsets[%d][1] field options dict."
                            % (cls.__name__, idx))
                self.check_field_spec(cls, model, fieldset[1]['fields'], "fieldsets[%d][1]['fields']" % idx)
            flattened_fieldsets = flatten_fieldsets(cls.fieldsets)
            if len(flattened_fieldsets) > len(set(flattened_fieldsets)):
                raise ImproperlyConfigured('There are duplicate field(s) in %s.fieldsets' % cls.__name__)
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/contrib/admin/validation.py/BaseValidator.validate_fieldsets/original