#28825: Templated email with {% extends parent_name %} doesn't re-resolve the 
base
template
---------------------------------+--------------------------------------
     Reporter:  Andrew           |                    Owner:  nobody
         Type:  Uncategorized    |                   Status:  new
    Component:  Template system  |                  Version:  1.11
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Description changed by Andrew:

Old description:

> In django templating you can use `{% extends parent_name %}` to indicate
> that the template is derived from another.  We use this feature along
> with django-templated-email to have different base email templates for
> white-label purposes.
>
> The issue appears to be that `{% extends parent_name %}` does not get re-
> evaluated  when the variable changes, eg. from `email/app1.email` to
> `email/app2.email`.
>
> * The Engine uses `django.template.loaders.cached.Loader`
> * The first time the template is loaded, the parent template is loaded
> based on `parent_name` is loaded
> * Subsequent emails load the template, but do not re-evaluate the
> `extends`
>
> If this is as-designed, how would one go about clearing out that cache.
> I am using code like this (when setting up my test case) but it doesn't
> appear to clear the cache, even though my `print()` debugging shows its
> the same object (`<django.template.loaders.cached.Loader object at
> 0x113e99828>`_
>
> {{{
> for template in engines.all():
>         for loader in template.engine.template_loaders:
>             loader.reset()
> }}}

New description:

 In django templating you can use `{% extends parent_name %}` to indicate
 that the template is derived from another.  We use this feature along with
 django-templated-email to have different base email templates for white-
 label purposes.

 The issue appears to be that `{% extends parent_name %}` does not get re-
 evaluated  when the variable changes, eg. from `email/app1.email` to
 `email/app2.email`.

 * The Engine uses `django.template.loaders.cached.Loader`
 * The first time the template is loaded, the parent template is loaded
 based on `parent_name` is loaded
 * Subsequent emails load the template, but do not re-evaluate the
 `extends`

 ----

 If this is as-designed, how would one go about clearing out that cache?
 When setting up my test case I call the code below,  but it doesn't appear
 to clear the cache, even though my `print()` debugging shows its the same
 object (`<django.template.loaders.cached.Loader object at 0x113e99828>`_

 {{{
 for template in engines.all():
         for loader in template.engine.template_loaders:
             loader.reset()
 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28825#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.ec1f89a30ad861619f1463a9656cd01f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to