I'm searching for the way to include javascript/css files inside django templates using symfony-like style or similar.
My base/layout.html template looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
{% load static %}
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta name="description" content="{% block meta_description %}{% endblock %}" />
<meta name="keywords" content="{% block meta_keywords %}{% endblock %}" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block meta_title %}{% endblock %} Daily-Cooking</title>
{% block javascript %}
<script type="text/javascript" src="http://yandex.st/jquery/1.6.2/jquery.min.js"></script>
{% endblock %}
{% block css %}
<link rel="stylesheet" href="{% get_static_prefix %}/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="{% get_static_prefix %}/blueprint/print.css" type="text/css" media="print">
<link rel="stylesheet" href="{% get_static_prefix %}/blueprint/src/forms.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="{% get_static_prefix %}/css/base.css" type="text/css" media="screen, projection">
<!--[if lt IE 8]>
<link rel="stylesheet" href="{% get_static_prefix %}/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]-->
{% endblock %}
</head>
<body>
{% include "base/header.html" %}
{% block content %}{% endblock %}
{% include "base/footer.html" %}
{% block layer %}{% endblock %}
</body>
</html>
I can easily add another template extending base one:
{% extends "base/layout.html" %}
{% block javascript%}
some custom scropt
{% endblock %}
This will work fine. But 2 problems: 1. I can't use {% block %} more than once 2. Every {% block javascript %} inside included template (for ex. header.html in example) will be treated as block fro THIS included template
The best way i can see: base/layout.html has something like: {% include_javascripts %}
Any child or included template: {% use_javascript "jquery.js" %}
Also, i want block {% block layer %}{% endblock %} extended similiar way and to be extended as many times as i want