How to create something like this:
If user is in: http://127.0.0.1:8000/about/
then in my base.html I have:
You are here: <li><a href="/about/">Home</a></li>
Etc.
Is there a simple way?
This can get tricky, depending on what you mean by "breadcrumbs".
/about/
is "Home"). There are a bajillion ways to do this, and it all sort of depends on how flexible you want it, how complicated your URL patterns get, whether you want to support nesting, etc.
Normally, I just use Django Breadcrumbs . This project handles all of the weirdness of breadcrumbs, has a very easy to use API, and handles even weird cases.
While a full code sample would probably be helpful, it's a long and thorny problem, so you're better off reading the documentation for django-breadcrumbs, and then returning here with questions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.