'Validate that fields only refer to existing fields, doesn\'t contain duplicates.'

def validate_fields(self, cls, model):

    if cls.fields:
        check_isseq(cls, 'fields', cls.fields)
        self.check_field_spec(cls, model, cls.fields, 'fields')
        if cls.fieldsets:
            raise ImproperlyConfigured(('Both    fieldsets    and    fields    are    specified    in    %s.' % cls.__name__))
        if (len(cls.fields) > len(set(cls.fields))):
            raise ImproperlyConfigured(('There    are    duplicate    field(s)    in    %s.fields' % cls.__name__))
