best_filters.dirname

best_filters.dirname(str)

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'