best_filters.
dirname
give the directory name of the path
It uses os.path.dirname()
Example
>>> c = {'mypath':'/a/b/c/myfile.extension'} >>> t = '{% load best_filters %}{{ mypath|dirname }}' >>> Template(t).render(Context(c)) '/a/b/c'