code: def build_attrs(self, *args, **kwargs):
          
          attrs = super(Select2Mixin, self).build_attrs(*args, **kwargs)
          if self.is_required:
              attrs.setdefault('data-allow-clear', 'false')
          else:
              attrs.setdefault('data-allow-clear', 'true')
              attrs.setdefault('data-placeholder', '')
  
          attrs.setdefault('data-minimum-input-length', 0)
          if 'class' in attrs:
              attrs['class'] += ' django-select2'
          else:
              attrs['class'] = 'django-select2'
          return attrs
docs: Add select2 data attributes.