I have a CharField who contains paths, like:
zero/one/two/three , or root/usr/et_cetera
The number of separators (here /) give us the depth of the 'node' in the path, so on the previous example, three has a depth of 3.
In python, I could write 'zero/one/two'.count('/'), but I wonder how to do it in a Django query.
What I search is something like following:
# Hypothetical code, does not work
Model.object.annotate(depth=CountChr('path', V('/'))).filter(depth=2)
I can't find a function who does that in the django documentation.