yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.
https://django-autocomplete-light.readthedocs.io
MIT License
1.81k stars 468 forks source link

renderer attribute is ignored when supering original "render" method on widget #1252

Open Quadric opened 3 years ago

Quadric commented 3 years ago

This is a WidgetMixin's render method:

    def render(self, name, value, attrs=None, renderer=None, **kwargs):
        """Call Django render together with `render_forward_conf`."""
        widget = super(WidgetMixin, self).render(name, value, attrs, **kwargs)
        try:
            field_id = attrs['id']
        except (KeyError, TypeError):
            field_id = name
        conf = self.render_forward_conf(field_id)
        return mark_safe(widget + conf)

When invoking "render" method the "renderer" is ignored - why? If project is configured for using a different form renderer (for ex. https://docs.djangoproject.com/en/3.2/ref/forms/renderers/#templatessetting) it ruins everything because then it uses a default DjangoTemplate renderer which is not ok.

jpic commented 3 years ago

Support for other renderers would be nice to see in a PR