Another advantage that I figured while finishing the DAL 4.0 PoC offering the 
AutocompleteLight WebComponent support in addition to Select2:

- easy to template with <slot>

Example:

def render(self, name, value, attrs=None, renderer=None):
choice = self.field.queryset.filter(pk=value).first()
deck = self.field.render_choice(choice) if choice else ''
return mark_safe(f'''
<autocomplete-select>
{super().render(name, value, dict(slot="select"))}
<div slot="deck" class="deck">{deck}</div>
<autocomplete-light slot="input" url="{self.url}">
<input slot="input" type="text" />
</autocomplete-light>
</autocomplete-select>
''')

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/wmQMvU7_HYzliBdAAxiENVvzAWhqSXsEge2wTHQMX1YoQwx-edppdG44ZbZOagmX5aqkVIlxMuExvRrHZc4ED7sQVYkK__8lWNesL1qJFis%3D%40protonmail.com.
  • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
    • ... Jacob Rief
      • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
        • ... Carlton Gibson
          • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
            • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
              • ... Jacob Rief

Reply via email to