I'm not sure I have an opinion on adding such a variable. It seems reasonable but I haven't seen much use of web components yet. I'm also not sure if e.g. the 'type' attribute is relevant if using a custom web component.
But afaict you can change the tag already by overriding render() to replace it, like: class MyWidget(SomeWidget): def render(self, *args, **kwargs): # Swap <input> for <my-element> return super().render(self, *args, **kwargs).replace('<input', '<my-element', count=1) On Thu, 23 Jul 2020 at 12:24, '1337 Shadow Hacker' via Django developers (Contributions to Django itself) <django-developers@googlegroups.com> wrote: > Hello > > Currently, we can set attributes on widgets during runtime but the input > tag name is hardcoded: > > > https://github.com/django/django/blob/master/django/forms/templates/django/forms/widgets/input.html > > Which means that you currently have to copy the input.html template for > every web component. > > Is it possible to make the tag name a variable to enable using custom HTML > elements without having to copy a template like we do with attrs ? > > Thank you in advance > > -- > 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 django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/-KA4DZPYgBR0IIfAEM7A4B22tZEgUZOhD5ihFHfxUrLd8xCl9scLrI-iOTm7CsKvvya6CrIWm2nZksqrvZDqcaZ2uMxhSeMcojzUCuOuQ0Q%3D%40protonmail.com > <https://groups.google.com/d/msgid/django-developers/-KA4DZPYgBR0IIfAEM7A4B22tZEgUZOhD5ihFHfxUrLd8xCl9scLrI-iOTm7CsKvvya6CrIWm2nZksqrvZDqcaZ2uMxhSeMcojzUCuOuQ0Q%3D%40protonmail.com?utm_medium=email&utm_source=footer> > . > -- Adam -- 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 django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM20BSFQ%3DzEO7yVZ3HtOn0WHdXXW%3D6UGvkeW0%3DFFGwQCFQ%40mail.gmail.com.