Navigation in django

后端 未结 30 1500

I\'ve just done my first little webapp in django and I love it. I\'m about to start on converting an old production PHP site into django and as part its template, there is a

30条回答
  •  没有蜡笔的小新
    2020-11-27 09:59

    I'm the author of django-lineage which I wrote specifically to solve this question :D

    I became annoyed using the (perfectly acceptable) jpwatts method in my own projects and drew inspiration from 110j's answer. Lineage looks like this:

    {% load lineage %}
    
    

    ancestor is simply replaced with "active" if the argument matches the start of current page URL.

    Variable arguments, and full {% url %} type reverse resolution, is also supported. I sprinkled in a few configuration options and fleshed it out a little and packaged it up for everyone to use.

    If anyone is interested, read a bit more about it at:

    >> github.com/marcuswhybrow/django-lineage

提交回复
热议问题