I’m not sure I’m quite following your issue.

At least to begin, can’t you just provide a custom base template, that
accepts whatever parameters you want?

Maybe there’s a case for adjusting the existing templates, but I’d imagine
making that decision based on code in play. (“Look, I’ve built this, and
see there’s duplication here”)

I’d imagine there comes a point where the widget templates become too
generic. Less comprehensible, and so harder to work with. Maybe abstracting
out the base element name would go beyond that point. (Which is to say, a
separate ‘component.html’ template might be better to use in such a case.)

But it’s hard to say in the abstract.

Perhaps if you could outline where you’re at and the issue you’re seeing in
more detail it would be easier?

Sorry if I’ve missed somewhere where you’ve already posted this.

Kind regards

Carlton

On Thu, 23 Jul 2020 at 20:12, '1337 Shadow Hacker' via Django developers
(Contributions to Django itself) <django-developers@googlegroups.com> wrote:

>
>
>
> Sent with ProtonMail <https://protonmail.com> Secure Email.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> Le jeudi, juillet 23, 2020 6:53 PM, Adam Johnson <m...@adamj.eu> a écrit :
>
> do you think it is better to create a widget class per custom element
>> instead of just switching the template_name variable or just setting the
>> tag name like any attr ?
>>
>
> I'd imagine so. This way you can make required attributes their own
> arguments to __init__, and any other customization you might need. It will
> also make the form class a little clearer
>
>
> So, you'd be against custom elements that just work after changing the tag
> ?
>
> I really thought we should strive for that, and leverage custom elements
> to remove boilerplate code rather than adding more.
>
> --
> 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/eWxmxo38Vf6jlKTPTeY5DIotKpeslP2lbGycb9hvbhmrI5i6iqlWTC_slmJeEvKZRhVLbJdhKQvqYRHrLv8Vpx6ROCm7V7L8EfiN_icXfX4%3D%40protonmail.com
> <https://groups.google.com/d/msgid/django-developers/eWxmxo38Vf6jlKTPTeY5DIotKpeslP2lbGycb9hvbhmrI5i6iqlWTC_slmJeEvKZRhVLbJdhKQvqYRHrLv8Vpx6ROCm7V7L8EfiN_icXfX4%3D%40protonmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAJwKpyT7bJ-weKBQm2of5qOQ2XX%2BG5vw-C8_Uggvp3Qb2-LZqQ%40mail.gmail.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