> On 24 Jul 2020, at 14:06, '1337 Shadow Hacker' via Django developers 
> (Contributions to Django itself) <django-developers@googlegroups.com> wrote:
> 
> Now for some examples:
> 
> class YourForm(forms.ModelForm):
>     class Meta:
>         model = YourModel
>         widgets = dict(
>              birth_date=forms.TextInput(attrs={'type': 'date', 'max': 
> max_date})
>         )

Right, but you can provide a different template here, components.html say, that 
took the `element` name. 

> Victory ! We now have a native date field with a one-liner ! But what if we 
> want to change to a duet date picker ? You need to change the tag name from 
> "input" to "duet-tag-picker":
> 
> forms.TextInput(attrs={'type': 'date', 'max': max_date}, 
> tag='duet-date-picker')
> 
> It seems the reason for being able to set attrs this way but not the tag name 
> too is because this was designed prior to the custom element W3C standard 
> that's now implemented in every browser.

Maybe. Maybe just that `input` is pretty generic in form land — it’s not 100% 
clear we need increase manageability by adding a template that allows 
constructing arbitrary HTML elements. (Note the __maybe__…) 

I’d use a custom template to begin. Then when you’re at the point of preparing 
a PR we can look at whether adjusting the templates makes sense. (Hopefully 
that seems reasonable to you.) 

Kind Regards,

Carlton

-- 
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/EEED97FE-6E11-45AC-B1EC-B6A12D437DB4%40gmail.com.
  • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
    • ... Adam Johnson
      • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
        • ... Adam Johnson
          • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
            • ... Carlton Gibson
              • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
                • ... Carlton Gibson
                • ... Tim Graham
                • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
                • ... Tim Graham
                • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
                • ... Tim Graham
                • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
                • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)

Reply via email to