I can see one main use case. Front end developers and designers would be able to extend templates without worrying about python code changes or doing a full copy and paste of the original template (if they can find it.)
Dougal On 15 Oct 2010 14:10, "Andrew Godwin" <and...@aeracode.org> wrote: > On 15/10/10 13:41, J. Pablo Martín Cobos wrote: >> Hi, >> >> I'm a Django developer since more or less 3 years. Some time ago I had >> the need for the extends templatetag to have more funcionality. >> >> The funcionality I mean is that a template can extends from "itself". >> I'm going to try to explain it better, so I will put Django admin as >> an example, although I needed it in others places. In many projects I >> wanted to customize the admin site, I wanted to tiny modify the >> change_list template or the change_form template, etc. I.E. like the >> following: >> >> file:templates/admin/change_list.html >> >> {% extends "admin/change_list.html" %} >> >> {% block extrastyle %} >> {{ block.super }} >> <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL >> }}css/my_change_list_css.css" /> >> {% endblock %} >> >> >> {% block breadcrumbs %} >> <div class="breadcrumbs"> >> <a href="../../"> >> {% trans "My Project" %} >> </a> >> › >> <a href="../"> >> {{ app_label|capfirst }} >> </a> >> › >> {{ cl.opts.verbose_name_plural|capfirst }} >> </div> >> {% endblock %} >> >> >> To perform something like this, we should copy all the change_list >> template (i.e. 100 lines of code), in order to add this two changes. >> For this subject I created a google-code project [1], wich is working >> in a little project of Universidad de Granada [2] succesfully. >> >> I wait for yours feedback, and I hope this could be usefull > > Hi Pablo, > > So, from what I can work out, this is a proposal for an {% extends %} > tag which allows you to extend from the parent template of the same name > (so it looks back in the list of possible templates, and picks the one > that comes before yours, in your case inheriting from the admin version > of the template with the same name? > > I'd like to know what sort of use cases you think this is necessary in - > in the example you provide, admin/change_list.html, the recommended way > of doing what you're doing would be to set change_list_template on the > ModelAdmin class to point to a different template which itself inherits > from admin/change_list.html, rather than having two with the same name, > which could be potentially confusing. > > Andrew > > -- > You received this message because you are subscribed to the Google Groups "Django developers" group. > To post to this group, send email to django-develop...@googlegroups.com. > To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com<django-developers%2bunsubscr...@googlegroups.com> . > For more options, visit this group at http://groups.google.com/group/django-developers?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.