#27974: Degraded performance when rendering ChoiceField with lots of options and
DEBUG=True
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: kapil
Type: | garg
Cleanup/optimization | Status: assigned
Component: Template system | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by kapil garg):
This [https://github.com/django/django/pull/4753 PR] which introduced
caching does not seem to work for nested includes. So the actual caching
will happen using patch given by Florian above. Also to resolve the above
2 problems, we need to update CycleNode state location just like ifchanged
(patch above) and then we should have separate cache for different include
nodes even if they are including the same template as this will force
creation of new nodes which use "self" as their state location. (patch
below)
{{{
diff --git a/django/template/loader_tags.py
b/django/template/loader_tags.py
index d043e5eb52..6050b9f61f 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -175,7 +175,7 @@ class IncludeNode(Node):
if not callable(getattr(template, 'render', None)):
# If not, we'll try our cache, and get_template()
template_name = template
- cache =
context.render_context.setdefault(self.context_key, {})
+ cache = context.render_context.dicts[0].setdefault(self,
{})
template = cache.get(template_name)
if template is None:
template =
context.template.engine.get_template(template_name)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27974#comment:11>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.238a87331d61390b78eef61a479ee24d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.