I think he means to override a template without changing it's name (since you 
don't control 3rd party app's views and the templates they call, most times). 
I've found a snippet to do this as {% extends "app:template/path.html" %}, a 
custom template loader. I don't have the code right now, but may be you can 
find it.

-----Mensaje original-----
De: yati sagade
Enviados:  09/07/2012 01:44:33
Asunto:  Re: masking only a small part of a template

I'm not sure by what you mean; There has always been template inheritance
in Django :) Just specify the template you want to extend as the first
statement in the template and to override a block in the template, just
start a block with the same name as the block you want to override. For
example, to override a block called "main" in "some_3rd_party/base.html",
you'd do something like:

    {% extends "some_3rd_party/base.html" %}
    ...
    {% block main %}
       <your stuff>
    {% endblock %}
    ...

All the blocks you don't override in the base template get included in the
resultant template as is. Sorry if you already knew all that :)

On Mon, Jul 9, 2012 at 7:36 AM, tWoolie <[email protected]> wrote:

> I have a template in a 3rd party app that i'm trying to override, but only
> a single block.
> Is there any way that I can do this without copy-pasting the entire
> template into the global templates dir just to change a few lines?
> Is there any way to create a template that "extends" itself from further
> down the search tree?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/snmqZSyfNlkJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Yati Sagade <http://twitter.com/yati_itay>

Twitter: @yati_itay <http://twitter.com/yati_itay> | Github:
yati-sagade<https://github.com/yati-sagade>

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" gr
Correo truncado a 2,000 caracteres.
:::0:8cd9b62d1bad8b6e64024aa7ff45475a:7d0::::

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to