You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi - I have a common template which renders a sortable table header. In a larger template I want to call it and pass in the context (e.g. name, whether it is sorted ascending/descending).
I understand the included template has access to the context of the template it is being included in, but how do I pass in additional context.
My outer template:
<tr>
{% include "tableHeaderSort.html" sort='ascending' title='Open'}
{% include "tableHeaderSort.html" sort='none' title='Closed'}
...
Is this possible?
Thanks!
The text was updated successfully, but these errors were encountered:
@djc How would one use macros for this - is there an example available anywhere? Or has something like Django's with keyword inside an include been implemented since this issue was reported?
For macros you'd have to pass all the required context in explicitly, you wouldn't have access to the ambient context inside the macro as far as I remember. There's a little bit of documentation and some tests.
Hi - I have a common template which renders a sortable table header. In a larger template I want to call it and pass in the context (e.g. name, whether it is sorted ascending/descending).
I understand the included template has access to the context of the template it is being included in, but how do I pass in additional context.
My outer template:
Is this possible?
Thanks!
The text was updated successfully, but these errors were encountered: