djangosnippets.org: Latest snippets tagged with 'custom-tag'http://djangosnippets.org/tags/custom-tag/2016-03-17T07:00:40.022829-05:00Relative paths for Django template tags 'extends' and 'include'.
2016-03-17T07:00:40.022829-05:00vb64http://djangosnippets.org/snippets/10558/<p><a href="http://stackoverflow.com/questions/671369/django-specifying-a-base-template-by-directory">The problem</a>: {% extends "./../base.html" %} won't work with extends.</p>
<p>It causes a lot of inconvenience, if you have an extensive hierarchy of django templates.
This library allows relative paths in argument of 'extends' and 'include' template tags. Relative path must start from "./"</p>
<p>Just write in your templates …</p>
Freely redistributable"Youtube watch link to embed" custom tag.
2011-09-25T15:27:58.027732-05:00I159http://djangosnippets.org/snippets/2554/<p>Tag for simple embed video from youtube watch link. It can be modified to manage size of embedded video.</p>
Freely redistributableAge - custom filter
2008-01-21T15:23:52.410395-06:00realmachttp://djangosnippets.org/snippets/557/<p>Based on the discussion at Empty Thoughts (http://blog.michaeltrier.com/2007/8/6/age-in-years-calculation) I built a quick and dirty custom filter.</p>
<p>Save this as a file in your "templatetags" folder. I called mine "calculate_age.py" and then in your template "{% load calculate_age %}" then use it, "{{ object.birthdate|age }}"</p>
Freely redistributable