On 15/07/10 13:40, justin jools wrote:

> 2. base.html with jquery nav, exactly the same except for
> {{ MEDIA_URL }} which is correct.
> 

FWIW, we use a jquery load line in our base template and it works fine
(pretty disastrous for us if it didn't).

You're 100% sure the pathss correct (like when you "view source" the
rendered page and look at the rendered links in your browser) -
forgetting a trailing slash on settings.MEDIA_URL is a common mistake,
as is inserting an extra one somewhere.

In case you've been away on mars or something: the "firebug" extension
for firefox is extremely useful for poking about rendered pages.

> <script src="{{ MEDIA_URL }}scripts/jquery-1.2.6.min.js"

[That's now a pretty old jquery version, not that it should matter
particularly.]

It's not clear to me if you've just got a test view that renders the
base template directly, or if you've really got child templates:
Was that really your base template though? I mean you've got no
{% block blah %} things for child pages to override.

They're relevant because you presumably have blocks in your base
template, and you presumably override them in the child templates, so
you might want to make sure you're not overriding a block containing the
jquery-loading script tag, or at least use {{block.super}}  to pull it
in if you do.

our base looks something like (simplified):

<html>
  <head>
    <title>{% block title %}BlahProj{% endblock title %}</title>

    <link type="text/css"
href="{{MEDIA_URL}}ext/jquery-ui/css/redmond/jquery-ui-1.8.2.custom.css"
rel="stylesheet" />
    <link type="text/css" href="{{MEDIA_URL}}blahproj/screen.css"
media="screen"
 rel="stylesheet" />

    <script type="text/javascript"
src="{{MEDIA_URL}}ext/jquery-ui/js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript"
src="{{MEDIA_URL}}ext/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"></script>


   {% block extra_head %}
   {% endblock extra_head %}
 </head>
 <body>
   {% block content %}
   {% endblock content %}
 </body>
</html>

Then child templates might do this:

{% extends "base.html" %}
{% block title %}{{block.super}} :: Foo{% endblock title %}

{% block extra_head %}
  {# maybe, say a grandchild: block.super #}
  <script type="text/javascript">
   $(function () {
      ...
   });
  </script>
{% endblock extra_head %}

{% block content %}
<p>Foo</p>
{% endblock content %}



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to