2010/10/15 J. Pablo Martín Cobos <goi...@gmail.com>:
>
> Really the problem comes when we reuse a application: from other people,
> from Django (i.e. django.contrib.admin), or even my own that we reuse in
> some projects. Usually you want to change slight things and usually you want
> only to change the visualization mode, you want to change the templates. You
> need to adapt the application to your project.
>

It's a pretty good use case. But there's a problem with your original
proposal: the admin provides a default "x.html" . Then you have some
3rd party application "A" that enhances the "x.html". And now comes
your application "B" that also wants to extend "x.html". So you write:

{% extends "x.html" %}

Which "x.html" should be chosen ? the one from admin or the one from
external app "A" ? Both are valid uses. There is a dangerous
temptation to say "next that would be loaded after this", but that
depends on loaders and application order  - lets don't go that way.

Instead, IMHO, a good way to do this would be verbose about from which
application you want the template to be loaded:

{% extends admin:"x.html" %} # extend x.html from admin
{% extends A:"x.html" %} #  extend x.html from application A

Unfortunately for this approach, templates aren't provided or bound to
applications - they're provided by loaders. It might be a good idea to
extend the loader protocol to me "namespace" aware.

My 2cents.

-- 
Łukasz Rekucki

-- 
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.

Reply via email to