code: def render(self, name, value, attrs=None, renderer=None):
          
          output = [super(TagAutoComplete, self).render(name, value, attrs)]
          output.append('<script type="text/javascript">')
          output.append('(function($) {')
          output.append('  $(document).ready(function() {')
          output.append('    $("#id_%s").select2({' % name)
          output.append('       width: "element",')
          output.append('       maximumInputLength: 50,')
          output.append('       tokenSeparators: [",", " "],')
          output.append('       tags: %s' % json.dumps(self.get_tags()))
          output.append('     });')
          output.append('    });')
          output.append('}(django.jQuery));')
          output.append('</script>')
          return mark_safe('\n'.join(output))
docs: Render the default widget and initialize select2.