Hi,
To follow up, when I tried the following:
* {% include "child_template.html" with zip_list=zip_list%}*
if the variable *zip_list* is a zip object, defined as following in the
view,
* zip_list= zip (list1, list2, list3)*
the "*include*" does not work. But if I pass any other normal variable
(such as a simple list, or numeric or string), the "*include*" tag works
fine.
How do I pass a zip object into this tag?
Thanks,
On Friday, 13 November 2020 at 23:22:13 UTC-7 David Nugent wrote:
> You can achieve what you are looking for using the include
> <https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#include>
> directive.
>
>
> Just have your parent and child include the same block and use with…
> phrase to override variables within the included template.
>
> Regards,
> David
>
>
> On 20201114, at 01:15, Tristania W <[email protected]> wrote:
>
> Is it possible to make one sub-template inherit a div with dynamic content
> from an upper level template?
>
> For eg., Template2 extends Template1. Within Template1, there is a div XXX
> that depends on a variable {{ var1 }}. This variable is passed to the view
> *def
> view1*, which renders Template 1. When Template2 is rendered, this div
> XXX is not rendered, because of the dynamic content.
>
> Is there a DRY (Don't Repeat Yourself) way to make this inheritance
> possible?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/497e48c4-3bd8-4f14-84df-b70146712e77n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/django-users/497e48c4-3bd8-4f14-84df-b70146712e77n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/7753fe09-32f0-41cc-bea8-e4928e5305ddn%40googlegroups.com.