[ckan-dev] Jinja2 customisations {% ckan_extends %} for 2.0

Aron Carroll aron.carroll at okfn.org
Fri Aug 10 09:20:51 UTC 2012


Okay cool, I'll try this out on Monday and add it to the documentation.

Fine with deprecating the filename argument.

Cheers,
Aron

On 10 Aug 2012, at 08:10, Toby Dacre wrote:

> Hi,
> 
> Just a note to say that I've changed the {% ckan_extends %} tag since our meet-up on wednesday
> 
> It now does not need a template name supplying - In fact I think we should just remove that as an option as it is purely for overriding templates lower in the `template stack` changing the template we are overriding seems dangerous unwanted.
> 
> @aron are you ok with this I'll throw warnings if supplied and throw an exception if the supplied template name isn't the same as the current one - to help the transition
> 
> The tag is now recursive so each template path can ckan_extend the templates below it in the stack.  The order is the same as plugins are defined in the .ini
> 
> here is an example from the qa extension that is effectively a replacement for the IGenshiFilter
> 
> templates/package/resource_read.html
> 
> {% ckan_extends %}
> 
> {% block resource_read_title %}
>   {{ super() }}
>   {{ h.qa_stars(c.resource.id) }}
> {% endblock %}
> 
> 
> Toby
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list