Re: Template Macros Like In Jinja

2008-01-22 Thread Papalagi Pakeha
On Jan 23, 2008 11:32 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 22, 2008 4:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > what's the reasoning behind not having and not planning to have macros > > in django templates? they look like a very useful construct compliant > > with D

[solution] Re: Template Macros Like In Jinja

2008-01-22 Thread Michal Ludvig
Hi Papa > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? Have a look at "Support for {% macro %} tags in templates" at http://www.djangosnippets.org/snippets/363/ I bet it's exactly what you're after. It lets you define ma

Re: Template Macros Like In Jinja

2008-01-22 Thread Karen Tracey
On Jan 22, 2008 5:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > On Jan 23, 2008 4:08 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > > > On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> > wrote: > > > i wonder if there is any way to have Macros in django templates > > > simila

Re: Template Macros Like In Jinja

2008-01-22 Thread James Bennett
On Jan 22, 2008 4:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > what's the reasoning behind not having and not planning to have macros > in django templates? they look like a very useful construct compliant > with DRY to me. Django's template system is meant to be a means of expressing pres

Re: Template Macros Like In Jinja

2008-01-22 Thread Papalagi Pakeha
On Jan 23, 2008 4:08 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > i wonder if there is any way to have Macros in django templates > > similar to what Jinja has (http://jinja.pocoo.org/)? > > No. > > The Jinja project was s

Re: Template Macros Like In Jinja

2008-01-22 Thread Rock
You can create an intermediate base class that extends your base class and includes elements like: {% if actions %} ... show action table ... {% endif %} {% if element %} ... show edit element form ... {% else %} ... show add element form ... {% endif %} and so forth and so on. Now your page ap

Re: Template Macros Like In Jinja

2008-01-22 Thread James Bennett
On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? No. The Jinja project was started specifically to add additional programming constructs that the Django tem

Re: Template Macros Like In Jinja

2008-01-22 Thread Ben Ford
Correct me if I'm wrong, but can't jinja be pretty much used as a direct drop in for django? Ben On 22/01/2008, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > Hello, > > I stress again that I don't know a ton about the django template system, > (or any for that matter) > That being said, I will proc

Re: Template Macros Like In Jinja

2008-01-21 Thread Jeff Anderson
Hello, I stress again that I don't know a ton about the django template system, (or any for that matter) That being said, I will proceed to say what I think I know: I don't believe that there is a macro-like feature in the django template system that could do that. You'd have to switch comple

Re: Template Macros Like In Jinja

2008-01-21 Thread [EMAIL PROTECTED]
hi jeff, thanks for your response. writing tags to replace macros looks like an overkill to me. especially because a macro may hold a content that's specific to a template and such a thing naturally belongs to the template itself and shouldn't go somewhere deep into the python codebase. have thi

Re: Template Macros Like In Jinja

2008-01-21 Thread Jeff Anderson
I'm no expert with any template system, but I believe you can write your own template tags for django's template system. http://www.djangoproject.com/documentation/templates_python/ At the section called "Extending the template system" Hopefully this is a good starting point! Jeff Anderson P

Template Macros Like In Jinja

2008-01-21 Thread Papalagi Pakeha
hi there! i wonder if there is any way to have Macros in django templates similar to what Jinja has (http://jinja.pocoo.org/)? the closest i could get was using 'include' tag and have the repetitive content in a standalone file, but it's pretty obscure to have a separate file for each little bit