Dear devs,
  I'd like to add a feature proposal for the 1.1 release. Basically,
at the moment the 'block' tag allows you only to override the block
you point it to, and I'd like to increase this functionality by adding
a 'block_append' tag which would allow you to append text to a block.
An example might be something like this:

# FILENAME: somefile.html
<html>
<head>
{% block css %}
<link rel="stylesheet" type="text/css" href="/css/somefile.css" />
{% endblock %}
</head>
<body>
some HTML code
</body>
</html>

In this case, I create a block to store all the CSS files I want to
link to in my HTML file. In a template which inherits from this, I may
want to add an additional CSS file. In order to do that now, I would
have to do this:

{% inherit "somefile.html" %}

{% block css %}
<!-- REPEAT THE OLD CSS LINK TAG: -->
<link rel="stylesheet" type="text/css" href="/css/somefile.css" />
<!-- EXTRA CSS: -->
<link rel="stylesheet" type="text/css" href="/css/anotherfile.css" />
{% endblock %}

So you can see that I'm duplicating my CSS link code here. This
violates DRY in no small way; if I rename "/css/somefile.css", I have
to change every template which inherits from the old. My suggestion is
to be able to do this:

{% inherit "somefile.html" %}

{% block_append css %}
<!-- EXTRA CSS *ONLY*: -->
<link rel="stylesheet" type="text/css" href="/css/anotherfile.css" />
{% endblock %}

So you can see that this might be useful for CSS and JavaScript
includes in HTML, as well as some other applications in other formats
(yet to be explored). If there is some support for this idea, I'll
open up a ticket, but I wanted to run it by everyone first.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to