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

Toby Dacre toby.okfn at gmail.com
Fri Aug 10 07:10:24 UTC 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120810/1efb398c/attachment.html>


More information about the ckan-dev mailing list