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

2023-06-12 Thread Dan Swain
Carlton Gibson has addressed my feature request: https://github.com/carltongibson/django-template-partials On Friday, July 15, 2022 at 8:21:52 PM UTC-4 Dan Swain wrote: > With the growing uptake of technologies like HTMX, I would like to see an > additional parameter added to

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

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

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

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

2022-07-15 Thread Dan Swain
With the growing uptake of technologies like HTMX, I would like to see an additional parameter added to render_to_string(). In my rewritten definition of render_to_string() below (taken from the docs), I have named the parameter “part”. In rendering portions of a template for responses to ajax