Closed jmuncaster closed 10 months ago
Django already has the with tag. Would that not serve? (That's how I'm using it myself.)
So...
{% with title="Title 1" content="Content 1" %}
{% partial my-card %}
{% end with %}
The include tag does have the with option like you describe. (I have to admit to never having used that, rather favouring the with tag...) so it's not 100% unlikely.
In general I'd favour keeping the API surface area as small as possible.
Got it, thanks for the recommendation! I guess my mental model here is that of a function call, so it feels odd to me to have to list the argument names in a with block before "calling the function". Under this mental model I think including the with statement in the call to the partial is better w.r.t. encapsulation. But perhaps I'm not thinking of it right.
I'm going to close this as out-of-scope for here.
The goal here is the named partials bit, with the aim of getting that into the DTL, hopefully over the Django 5.x cycle.
Use the with
tag if you need it.
Hi, Thanks for a neat little library. I am asking about a feature that I was expecting to see but which is not there, and was wondering if it is intended to be implemented or is out-of-scope.
I was expecting to define partials essentially as mini reusable blocks in a page.
(I think these are sometimes called "components")
Is something like this planned for this project?