Re: Feature Request: New parameter for render_to_string() to render part of a template using a selector

2022-07-16 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
I’m also -1. There are many ways to “partially render” a template. I covered one in the Django-htmx docs mention one: https://django-htmx.readthedocs.io/en/latest/tips.html#partial-rendering . The proposal to render the full template and then throw away most of the result is a particularly wastefu

Re: Feature Request: New parameter for render_to_string() to render part of a template using a selector

2022-07-16 Thread Ken Whitesell
I'm going to chime in as a -1 here. It does not seem to me that you can guarantee that you have the correct element(s) unless you actually render the complete template. Once you've rendered that template, then you can use tools like BeautifulSoup to extract the elements desired and ignore the

Re: Feature Request: New parameter for render_to_string() to render part of a template using a selector

2022-07-16 Thread charettes
Don't you have to render the template in the first place if you want to extract a fragment of it? If that's the case then shouldn't render_to_string be left unchanged and libraries interested in this feature build something on top of it to achieve what they're after? Given render_to_string is c