If template B extends template A, template B renders/parses its content
independently before being added to the parent A template.
Is there a way to make template B *wait* and render only *after* when added
to the parent A template?
Independent rendering of extended pages ( same thing happens with the {%
include %}
<https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#include> tag
too [ see the Note section there] ) sounds great if thats what one expects.
In my case, I wish I could let B (along with any includes made) *wait* ,
conjoin with the parent template, A, then all in unison, renders/parses the
content together. I tried to do below, but it failed, for obvious reasons (
$ function isn't defined. Template_B doesn't reference jquery resource )
template_B.html:
{% extends 'template_A.html' %}
{# usual html stuffs #}
{% block content %}
{# page content stuffs here #}
<script type="text/javascript">
// A function targeting a specific area of, only
// and Only the template_B.html page, e.g
$( ".class" ).addClass( "new-class" );
</script>
{% endblock %}
What I want to have is:
template_A.html
<html>
<head><!-- Head things -->
<script src="jquery-resource"></script>
</head>
<body>
<!-- below snippet coming from template_B.html -->
{% block content %}
{# page content stuffs here #}
<script type="text/javascript">
// A function targeting a specific area of, only
// and Only the template_B.html page, e.g
$( ".class" ).addClass( "new-class" );
</script>
{% endblock %}
</body>
</html>
Then when everything of template B has arrived, django *now* renders the
page, in which case,
Is such approach a bad thing? Performance-wise? Perhaps security-wise?
Please enlighten me. Such a feature wouldn't be default, but a switch in
cases like my own, one can turn on.
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c4106146-0892-4513-bab5-f6c7d18c64a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.