Hi!

I just discovered this thread on the mailing list. I implemented also
template recursion in this modified django-overextends:

https://github.com/wlanslovenija/django-overextends/blob/nested-extends/overextends/templatetags/overextends_tags.py

It supports all possible combinations. For example, not just
"base.html" extending "base.html", but also "user.hml" extending
"base.html" which extends "base.html" (example:
https://github.com/mitar/overextends-test).

In fact, it allows arbitrary nesting and combinations. It works by
keeping a list of possible sources for each template and as template
is rendered it removes it from the list, so that next time it is not
loaded anymore.

Currently it is implemented as a custom tag and monkey-patches Django
to provide template origin to tokens also when TEMPLATE_DEBUG is
false.

See https://code.djangoproject.com/ticket/17199#comment:9

Comments band benchmarks are welcome.


Mitar

On Thu, Dec 12, 2013 at 12:33 AM, unai <u...@gisa-elkartea.org> wrote:
> Hi there!
>
>> I'm working on an other solution that instead of relying on loader
>> skipping relies on template skipping.
>
> Sorry for keeping you waiting on updates for so long!
>
> I was able to put some time into it today. Although it isn't nothing
> definitive and testing, benchmarking and docs are missing, here is some actual
> code for you to look at:
>
> https://github.com/unaizalakain/django/compare/template_selfreference
>
> You can totally ignore the testing commit. The loaders commit per se is
> relatively small and the idea behind it is quite simple. As you already know,
> any critic, suggestion or idea is highly appreciated ;-)
>
> I'm going to be able to put some more effort into this tomorrow.
>
> Best regards,
>
> Unai Zalakain



-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKLmikMScJoj_Z%2BGM6PAPNQ_UVoG9xcT_C5dWOKQwtmbxwHMQg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to