Hi,

I have seen some discussion in this group on how to handle duplicate 
form.media in template includes.

I have the following the following base.html with scripts at the end of the 
body. I am following h5bp convention:

        <script 
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="{{ STATIC_URL 
}}js/vendor/jquery-1.9.1.min.js"><\/script>')</script>

        <script src="{{ STATIC_URL }}js/vendor/bootstrap.min.js"></script>
        <script src="{{STATIC_URL }}js/main.js"></script>

        {% block script %}{% endblock %}
       </body>

In my actual template, I include multiple templates and they 
are independent and reusable:

{% extends "base.html" %}
{% block script %}
<script src="{{ STATIC_URL }}js/vendor/jquery.chained.remote.js"></script>
<script 
src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script>...</script>
{% endblock script %}

{% block content %}
{% include "sub_template1.html" %}
{% include "sub_template2.html" %}
{% endblock %}


In sub_template, I do have js scripts too and within the script block. But 
according to the docs, include “render this subtemplate and include the 
HTML”. 

And these sub templates have common js scripts because I'm trying to keep 
them independent so that I can reuse the forms in other places in my app.

1. I can't seem to modularize my template/forms using include statement and 
have them loaded at the end of the page using the block tag. 

2. How to avoid the duplication?

What should the right approach to solve the problems?


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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to