Closed danjac closed 11 months ago
Hi @danjac. Thanks for the report.
I can see why you would want this, but I think it's kind-of orthogonal to django-template-partials
β¦βit's more like you need a caching tag.
See the discussion on Django Trac #6378 and the related there.
Yes I always end up with a "render_as" tag (basically wrapping render_to_string
) for this issue, as it's something the core developers don't want to add to {% include %}
.
For me, a separate capture tag is better than adding as
all over the place... π€·ββοΈ
As in django-capture-tag?
@danjac I haven't looked at the details there, but if it does what it says, then something like that would be useful IMO. (IIUC the resolution on Django #6378 was along the lines of what exactly is still needed here?, rather than no, never, but (again) π€·ββοΈ )
Hi @danjac.
@ghickman pointed me to the fragment
tag in Django-slippers, that does this:
https://mitchel.me/slippers/docs/template-tags-filters/#fragment
I need to merge #9 and push a new version (During Sept π―) but once that's in place you should be able to do what you're looking for here (at the same time as defining a named partial)
Great, thank you!
I have a use-case where I have a set of pagination links at the top and bottom of the page.
It would be optimal to be able to render the partial into a variable, so it doesn't get evaluated twice, for example: