Hi Andrew,

I think that in my first e-mail I didn't explain well the problem. Really it
was a difficult for me explain it even in spanish with my workmate, but at
the end they all agree with me.

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.

Many times I had to overwrite some templates, of the some application that I
had reuse, and I had to overwrite all the template, and this is very dirty
(for me). It's possible to do in ModelAdmin as you say, but it is more
confuse way to do. Especially when the ModelAdmin of the application is not
yours and it is not set change_list_template. It's possible, but I think
that it's a more difficult solution. But really it was only a example.

I tell you another example. I have use many times, in various projects, i.e.
django-messages [1] i I wanted to overwrite the base template [2] and add
one class in the block "bodyclass" I had to copy all the template. In this
case, is not so a problem  because they are only 13 lines, but you can
imagine that it can have 100 lines, or more like change_list template.

Regards and thanks


--
REF's

1. http://code.google.com/p/django-messages/
2.
http://code.google.com/p/django-messages/source/browse/trunk/django_messages/templates/django_messages/base.html

--

Pablo Martín

El 15 de octubre de 2010 14:41, J. Pablo Martín Cobos
<goi...@gmail.com>escribió:

> 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>
>     &rsaquo;
>     <a href="../">
>         {{ app_label|capfirst }}
>     </a>
>     &rsaquo;
>     {{ 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
>
> Regards,
>
> --
>
> REF's
>
> 1. http://code.google.com/p/django-smart-extends/
> 2. http://spinoff.ugr.es/
>
> --
>
> Pablo Martín
>

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