On 08/06/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > On 6/8/07, Noam <[EMAIL PROTECTED]> wrote: > > Let me improve my suggestion, so that it mostly solves James' concern > > and can be explained in one sentence: > > > > --------- > > Multiple blocks with the same name would be allowed, as long as all of > > them have the same content. > > --------- > > I'm not sure I like that as it stands. In your example, you provide > content for both of the blocks, which clearly violates DRY, since (by > virtue of your new rule) they're always going to be identical. If a > template designer ever has to update one, they have to update both. > If the time comes when you need a page with a different title in the window and in the heading, you can always extend your base template like this:
<html> <head> <title>{% block windowtitle %}Bug System - {% block title %}Page Title{% endblock %}{% endblock %}</title> </head> </body> <h1>{% block headingtitle %}{% block title %}Page Title{% endblock %}{% endblock %}</h1> {% block body %}Page Body{% endblock %} </body> </html> With that template, the original specific template would continue to work: {% extends "base.html" %} {% block title %}Post a New Bug{% endblock %} {% block body %}...{% endblock %} But you will also be able to write a template like this: {% extends "base.html" %} {% block windowtitle %}Bug 12345{% endblock %} {% block headingtitle %}Bug 12345 - Allow multiple blocks with the same name{% endblock %} {% block body %}...{% endblock %} Does it help? > I'm still -0 on this, but I might be +0 (yeah, big change) if the rule > stated that in order to have multiple blocks with the same name, all > must be EMPTY. This would allow a child template to fill in multiple > blocks, while not giving template designers a reason to get confused > by duplicate content. > I don't think it's confusing that both {% block title %} have the same content - it just shows that they will get the same contents in the rendered page. > I'm still not sold on the idea as a whole though, it just seems like > any support for it would be quite a mess, whether for the > implementation or the users. About the implementation - I think that it is best to try to implement and see how complicated is it. About the users - I don't think it will be a mess. People with a need like mine will just write two empty blocks and everything will work as they expected, or will write one empty block and one full block, will get an error stating that multiple blocks with the same name in the same template must have the same content, and fix it. I don't see what further complications should arise. > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---